Commit 1c62f66c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Be much more consistent about snapshotting session workspace when

doing an esi-include.

This should reduce the pressure on session workspace from nested
ESI includes considerably.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4073 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 65373f5f
......@@ -1087,6 +1087,10 @@ cnt_start(struct sess *sp)
/* XXX: Don't bother with write failures for now */
(void)write(sp->fd, r, strlen(r));
/* XXX: When we do ESI includes, this is not removed
* XXX: because we use http0 as our basis. Believed
* XXX: safe, but potentially confusing.
*/
http_Unset(sp->http, H_Expect);
}
......
......@@ -760,9 +760,12 @@ ESI_Deliver(struct sess *sp)
struct esi_bit *eb;
struct object *obj;
struct worker *w;
char *ws_wm;
struct http http_save;
w = sp->wrk;
WRW_Reserve(w, &sp->fd);
http_save.magic = 0;
VTAILQ_FOREACH(eb, &sp->obj->esibits, list) {
if (Tlen(eb->verbatim)) {
if (sp->http->protover >= 1.1)
......@@ -784,8 +787,17 @@ ESI_Deliver(struct sess *sp)
sp->esis++;
obj = sp->obj;
sp->obj = NULL;
/* Save the master objects HTTP state, we may need it later */
if (http_save.magic == 0)
http_save = *sp->http;
/* Reset request to status before we started messing with it */
*sp->http = *sp->http0;
/* XXX: reset sp->ws */
/* Take a workspace snapshot */
ws_wm = WS_Snapshot(sp->ws);
http_SetH(sp->http, HTTP_HDR_URL, eb->include.b);
if (eb->host.b != NULL) {
http_Unset(sp->http, H_Host);
......@@ -822,10 +834,17 @@ ESI_Deliver(struct sess *sp)
assert(sp->step == STP_DONE);
sp->esis--;
sp->obj = obj;
/* Reset the workspace */
WS_Reset(sp->ws, ws_wm);
WRW_Reserve(sp->wrk, &sp->fd);
if (sp->fd < 0)
break;
}
/* Restore master objects HTTP state */
if (http_save.magic)
*sp->http = http_save;
if (sp->esis == 0 && sp->http->protover >= 1.1)
(void)WRW_Write(sp->wrk, "0\r\n\r\n", -1);
if (WRW_FlushRelease(sp->wrk))
......
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