Commit ba8e58b4 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Avoid spreading req.body status logic all over the place

parent e9af8be8
......@@ -389,7 +389,6 @@ struct busyobj {
* is recycled.
*/
unsigned retries;
enum req_body_state_e initial_req_body_status;
struct req *req;
struct sess *sp;
struct worker *wrk;
......@@ -406,6 +405,8 @@ struct busyobj {
struct objcore *stale_oc;
struct objcore *fetch_objcore;
const char *no_retry;
struct http_conn *htc;
struct pool_task fetch_task;
......
......@@ -240,7 +240,6 @@ vbf_stp_mkbereq(struct worker *wrk, struct busyobj *bo)
bo->ws_bo = WS_Snapshot(bo->ws);
HTTP_Clone(bo->bereq, bo->bereq0);
bo->initial_req_body_status = bo->req->req_body_status;
if (bo->req->req_body_status == REQ_BODY_NONE) {
bo->req = NULL;
ObjSetState(bo->wrk, bo->fetch_objcore, BOS_REQ_DONE);
......@@ -270,12 +269,9 @@ vbf_stp_retry(struct worker *wrk, struct busyobj *bo)
assert(bo->fetch_objcore->boc->state <= BOS_REQ_DONE);
if (bo->fetch_objcore->boc->state == BOS_REQ_DONE &&
bo->initial_req_body_status != REQ_BODY_NONE &&
bo->bereq_body == NULL) {
/* We have already released the req and there was a
* request body that was not cached. Too late to retry. */
VSLb(bo->vsl, SLT_Error, "req.body already consumed");
if (bo->no_retry != NULL) {
VSLb(bo->vsl, SLT_Error,
"Retry not possible, %s", bo->no_retry);
return (F_STP_FAIL);
}
......
......@@ -120,6 +120,9 @@ V1F_SendReq(struct worker *wrk, struct busyobj *bo, uint64_t *ctr_hdrbytes,
V1L_Chunked(wrk);
i = VRB_Iterate(wrk, bo->vsl, bo->req, vbf_iter_req_body, bo);
if (bo->req->req_body_status != REQ_BODY_CACHED)
bo->no_retry = "req.body not cached";
if (bo->req->req_body_status == REQ_BODY_FAIL) {
/*
* XXX: (#2332) We should test to see if the backend
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment