Commit 779406a6 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Shuffle more stuff between proto-specific and generic fetch code.

parent eef05a8a
......@@ -443,7 +443,31 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
assert(bo->state == BOS_REQ_DONE);
VBO_setstate(bo, BOS_FETCHING);
switch (bo->htc.body_status) {
case BS_NONE:
break;
case BS_ERROR:
/* XXX: Why not earlier ? */
bo->should_close |=
VFP_Error(bo, "error incompatible Transfer-Encoding");
break;
default:
if (bo->vbc == NULL)
(void)VFP_Error(bo, "Backend connection gone");
else
V1F_fetch_body(bo);
break;
}
bo->t_body = VTIM_mono();
if (bo->vbc != NULL) {
if (bo->should_close)
VDI_CloseFd(&bo->vbc);
else
VDI_RecycleFd(&bo->vbc);
AZ(bo->vbc);
}
bo->vfp = NULL;
......
......@@ -330,6 +330,7 @@ V1F_fetch_body(struct busyobj *bo)
obj = bo->fetch_obj;
CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
CHECK_OBJ_NOTNULL(obj->http, HTTP_MAGIC);
AN(bo->vbc);
assert(bo->state == BOS_FETCHING);
......@@ -340,8 +341,6 @@ V1F_fetch_body(struct busyobj *bo)
/* XXX: pick up estimate from objdr ? */
cl = 0;
switch (htc->body_status) {
case BS_NONE:
break;
case BS_LENGTH:
cl = vbf_fetch_number(bo->h_content_length, 10);
......@@ -366,14 +365,9 @@ V1F_fetch_body(struct busyobj *bo)
if (bo->vfp->end(bo))
assert(bo->state == BOS_FAILED);
break;
case BS_ERROR:
bo->should_close |=
VFP_Error(bo, "error incompatible Transfer-Encoding");
break;
default:
INCOMPL();
WRONG("Wrong body_status");
}
bo->t_body = VTIM_mono();
AZ(bo->vgz_rx);
/*
......@@ -391,12 +385,4 @@ V1F_fetch_body(struct busyobj *bo)
STV_trim(st, st->len, 1);
}
}
if (bo->vbc != NULL) {
if (bo->should_close)
VDI_CloseFd(&bo->vbc);
else
VDI_RecycleFd(&bo->vbc);
}
AZ(bo->vbc);
}
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