]> err.no Git - varnish/commitdiff
Cache the vcl_fetch{} result, in case vcl_discard{} (via LRU) overwrites
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 2 Mar 2009 13:39:09 +0000 (13:39 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 2 Mar 2009 13:39:09 +0000 (13:39 +0000)
it during body fetch.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3856 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_center.c

index 706bab62feb294db3417d8941734c66de2bae969..37fb8fb9de5b359f6840bf7485dd1c850a585341 100644 (file)
@@ -380,6 +380,7 @@ cnt_fetch(struct sess *sp)
        struct http *hp, *hp2;
        struct object *o;
        char *b;
+       unsigned handling;
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
@@ -442,7 +443,14 @@ cnt_fetch(struct sess *sp)
 
        VCL_fetch_method(sp);
 
-       o = HSH_NewObject(sp, sp->handling != VCL_RET_DELIVER);
+       /*
+        * When we fetch the body, we may hit the LRU cleanup and that
+        * will overwrite sp->handling, so we have to save our plans
+        * here.
+        */
+       handling = sp->handling;
+
+       o = HSH_NewObject(sp, handling != VCL_RET_DELIVER);
 
        if (sp->objhead != NULL) {
                CHECK_OBJ_NOTNULL(sp->objhead, OBJHEAD_MAGIC);
@@ -498,7 +506,7 @@ cnt_fetch(struct sess *sp)
 
        VBE_free_bereq(&sp->bereq);
 
-       switch (sp->handling) {
+       switch (handling) {
        case VCL_RET_RESTART:
                HSH_Drop(sp);
                sp->director = NULL;