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

Minor polish

parent b2b35a52
...@@ -235,19 +235,18 @@ cnt_transmit(struct worker *wrk, struct req *req) ...@@ -235,19 +235,18 @@ cnt_transmit(struct worker *wrk, struct req *req)
const char *r; const char *r;
uint16_t status; uint16_t status;
int sendbody; int sendbody;
intmax_t resp_len; intmax_t clval;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->transport, TRANSPORT_MAGIC);
/* Grab a ref to the bo if there is one, and hand it down */ /* Grab a ref to the bo if there is one */
boc = HSH_RefBusy(req->objcore); boc = HSH_RefBusy(req->objcore);
CHECK_OBJ_NOTNULL(req->transport, TRANSPORT_MAGIC); clval = http_GetContentLength(req->resp);
resp_len = http_GetContentLength(req->resp);
if (boc != NULL) if (boc != NULL)
req->resp_len = resp_len; req->resp_len = clval;
else else
req->resp_len = ObjGetLen(req->wrk, req->objcore); req->resp_len = ObjGetLen(req->wrk, req->objcore);
...@@ -266,6 +265,7 @@ cnt_transmit(struct worker *wrk, struct req *req) ...@@ -266,6 +265,7 @@ cnt_transmit(struct worker *wrk, struct req *req)
} else } else
sendbody = 1; sendbody = 1;
if (sendbody >= 0) {
if (!req->disable_esi && req->resp_len != 0 && if (!req->disable_esi && req->resp_len != 0 &&
ObjHasAttr(wrk, req->objcore, OA_ESIDATA)) ObjHasAttr(wrk, req->objcore, OA_ESIDATA))
VDP_push(req, VDP_ESI, NULL, 0); VDP_push(req, VDP_ESI, NULL, 0);
...@@ -275,16 +275,18 @@ cnt_transmit(struct worker *wrk, struct req *req) ...@@ -275,16 +275,18 @@ cnt_transmit(struct worker *wrk, struct req *req)
!RFC2616_Req_Gzip(req->http)) !RFC2616_Req_Gzip(req->http))
VDP_push(req, VDP_gunzip, NULL, 1); VDP_push(req, VDP_gunzip, NULL, 1);
if (cache_param->http_range_support && http_IsStatus(req->resp, 200)) { if (cache_param->http_range_support &&
http_IsStatus(req->resp, 200)) {
http_SetHeader(req->resp, "Accept-Ranges: bytes"); http_SetHeader(req->resp, "Accept-Ranges: bytes");
if (sendbody && http_GetHdr(req->http, H_Range, &r)) if (sendbody && http_GetHdr(req->http, H_Range, &r))
VRG_dorange(req, r); VRG_dorange(req, r);
} }
}
if (sendbody < 0) { if (sendbody < 0) {
/* Don't touch pass+HEAD C-L */ /* Don't touch pass+HEAD C-L */
sendbody = 0; sendbody = 0;
} else if (resp_len >= 0 && resp_len == req->resp_len) { } else if (clval >= 0 && clval == req->resp_len) {
/* Reuse C-L header */ /* Reuse C-L header */
} else { } else {
http_Unset(req->resp, H_Content_Length); http_Unset(req->resp, H_Content_Length);
......
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