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,25 +265,28 @@ cnt_transmit(struct worker *wrk, struct req *req) ...@@ -266,25 +265,28 @@ cnt_transmit(struct worker *wrk, struct req *req)
} else } else
sendbody = 1; sendbody = 1;
if (!req->disable_esi && req->resp_len != 0 && if (sendbody >= 0) {
ObjHasAttr(wrk, req->objcore, OA_ESIDATA)) if (!req->disable_esi && req->resp_len != 0 &&
VDP_push(req, VDP_ESI, NULL, 0); ObjHasAttr(wrk, req->objcore, OA_ESIDATA))
VDP_push(req, VDP_ESI, NULL, 0);
if (cache_param->http_gzip_support &&
ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) && if (cache_param->http_gzip_support &&
!RFC2616_Req_Gzip(req->http)) ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) &&
VDP_push(req, VDP_gunzip, NULL, 1); !RFC2616_Req_Gzip(req->http))
VDP_push(req, VDP_gunzip, NULL, 1);
if (cache_param->http_range_support && http_IsStatus(req->resp, 200)) {
http_SetHeader(req->resp, "Accept-Ranges: bytes"); if (cache_param->http_range_support &&
if (sendbody && http_GetHdr(req->http, H_Range, &r)) http_IsStatus(req->resp, 200)) {
VRG_dorange(req, r); http_SetHeader(req->resp, "Accept-Ranges: bytes");
if (sendbody && http_GetHdr(req->http, H_Range, &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);
......
...@@ -565,7 +565,7 @@ sml_setattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr, ...@@ -565,7 +565,7 @@ sml_setattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr,
if (o->esidata == NULL) if (o->esidata == NULL)
return (NULL); return (NULL);
o->esidata->len = len; o->esidata->len = len;
retval = o->esidata->ptr; retval = o->esidata->ptr;
break; break;
case OA_FLAGS: case OA_FLAGS:
assert(len == sizeof o->oa_flags); assert(len == sizeof o->oa_flags);
......
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