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

Go over prepresp and remove a suboptimal optimization for len=0 objects.

parent 31ffe7cc
...@@ -184,7 +184,8 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -184,7 +184,8 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* We have a refcounted object on the session, now deliver it. * We have a refcounted object on the session, and possibly the busyobj
* which is fetching it, prepare a response.
* *
DOT subgraph xcluster_prepresp { DOT subgraph xcluster_prepresp {
DOT prepresp [ DOT prepresp [
...@@ -212,21 +213,22 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -212,21 +213,22 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC); CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
CHECK_OBJ_NOTNULL(req->vcl, VCL_CONF_MAGIC); CHECK_OBJ_NOTNULL(req->vcl, VCL_CONF_MAGIC);
if (bo != NULL)
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
req->res_mode = 0; req->res_mode = 0;
if (bo == NULL) if (bo == NULL) {
req->res_mode |= RES_LEN; if (!req->disable_esi && req->obj->esidata != NULL) {
/* In ESI mode, we can't know the aggregate length */
if (bo == NULL && !req->disable_esi && req->obj->esidata != NULL) { req->res_mode &= ~RES_LEN;
/* In ESI mode, we don't know the aggregate length */ req->res_mode |= RES_ESI;
req->res_mode &= ~RES_LEN; } else {
req->res_mode |= RES_ESI; req->res_mode |= RES_LEN;
}
} else {
AZ(bo->do_esi);
} }
if (req->esi_level > 0) { if (req->esi_level > 0) {
/* Included ESI object, always CHUNKED or EOF */
req->res_mode &= ~RES_LEN; req->res_mode &= ~RES_LEN;
req->res_mode |= RES_ESI_CHILD; req->res_mode |= RES_ESI_CHILD;
} }
...@@ -242,14 +244,8 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -242,14 +244,8 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
} }
if (!(req->res_mode & (RES_LEN|RES_CHUNKED|RES_EOF))) { if (!(req->res_mode & (RES_LEN|RES_CHUNKED|RES_EOF))) {
if (req->obj->len == 0 && /* We havn't chosen yet, do so */
(bo == NULL || !bo->do_stream)) if (!req->wantbody) {
/*
* If the object is empty, neither ESI nor GUNZIP
* can make it any different size
*/
req->res_mode |= RES_LEN;
else if (!req->wantbody) {
/* Nothing */ /* Nothing */
} else if (req->http->protover >= 11) { } else if (req->http->protover >= 11) {
req->res_mode |= RES_CHUNKED; req->res_mode |= RES_CHUNKED;
...@@ -901,7 +897,7 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -901,7 +897,7 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
if (req->obj->objcore != NULL) if (req->obj->objcore != NULL)
HSH_Ref(req->obj->objcore); HSH_Ref(req->obj->objcore);
if (bo->state > BOS_FAILED) { if (bo->state == BOS_FINISHED) {
VBO_DerefBusyObj(wrk, &req->busyobj); VBO_DerefBusyObj(wrk, &req->busyobj);
} else if (bo->state == BOS_FAILED) { } else if (bo->state == BOS_FAILED) {
/* handle early failures */ /* handle early failures */
......
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