r3879 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Wed Mar 4 13:28:17 CET 2009
Author: phk
Date: 2009-03-04 13:28:16 +0100 (Wed, 04 Mar 2009)
New Revision: 3879
Modified:
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/bin/varnishd/cache_pool.c
Log:
Setup the http structs in worker when we annex them for use.
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2009-03-04 12:13:54 UTC (rev 3878)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2009-03-04 12:28:16 UTC (rev 3879)
@@ -385,8 +385,9 @@
AN(sp->director);
AZ(sp->vbe);
+ /* sp->wrk->http[0] is (still) bereq */
sp->wrk->beresp = &sp->wrk->http[1];
- sp->wrk->beresp1 = &sp->wrk->http[2];
+ http_Setup(sp->wrk->beresp, sp->wrk->ws);
i = FetchHdr(sp);
@@ -394,17 +395,21 @@
* Save a copy before it might get mangled in VCL. When it comes to
* dealing with the body, we want to see the unadultered headers.
*/
+ sp->wrk->beresp1 = &sp->wrk->http[2];
*sp->wrk->beresp1 = *sp->wrk->beresp;
if (i) {
- sp->err_code = 503;
- sp->step = STP_ERROR;
if (sp->objhead) {
CHECK_OBJ_NOTNULL(sp->objhead, OBJHEAD_MAGIC);
CHECK_OBJ_NOTNULL(sp->objcore, OBJCORE_MAGIC);
HSH_DerefObjCore(sp);
}
AZ(sp->obj);
+ sp->wrk->bereq = NULL;
+ sp->wrk->beresp = NULL;
+ sp->wrk->beresp1 = NULL;
+ sp->err_code = 503;
+ sp->step = STP_ERROR;
return (0);
}
@@ -491,10 +496,13 @@
AN(sp->director);
if (i) {
+ HSH_Drop(sp);
+ AZ(sp->obj);
+ sp->wrk->bereq = NULL;
+ sp->wrk->beresp = NULL;
+ sp->wrk->beresp1 = NULL;
sp->err_code = 503;
sp->step = STP_ERROR;
- HSH_Drop(sp);
- AZ(sp->obj);
return (0);
}
@@ -506,6 +514,9 @@
HSH_Drop(sp);
sp->director = NULL;
sp->restarts++;
+ sp->wrk->bereq = NULL;
+ sp->wrk->beresp = NULL;
+ sp->wrk->beresp1 = NULL;
sp->step = STP_RECV;
return (0);
case VCL_RET_PASS:
@@ -517,8 +528,11 @@
case VCL_RET_DELIVER:
break;
case VCL_RET_ERROR:
+ HSH_Drop(sp);
+ sp->wrk->bereq = NULL;
+ sp->wrk->beresp = NULL;
+ sp->wrk->beresp1 = NULL;
sp->step = STP_ERROR;
- HSH_Drop(sp);
return (0);
default:
WRONG("Illegal action in vcl_fetch{}");
@@ -532,6 +546,8 @@
}
sp->acct_req.fetch++;
sp->wrk->bereq = NULL;
+ sp->wrk->beresp = NULL;
+ sp->wrk->beresp1 = NULL;
sp->step = STP_DELIVER;
return (0);
}
@@ -769,6 +785,7 @@
AN(sp->objcore);
AN(sp->objhead);
sp->wrk->bereq = &sp->wrk->http[0];
+ http_Setup(sp->wrk->bereq, sp->wrk->ws);
http_FilterHeader(sp, HTTPH_R_FETCH);
VCL_miss_method(sp);
switch(sp->handling) {
@@ -832,6 +849,7 @@
AZ(sp->obj);
sp->wrk->bereq = &sp->wrk->http[0];
+ http_Setup(sp->wrk->bereq, sp->wrk->ws);
http_FilterHeader(sp, HTTPH_R_PASS);
VCL_pass_method(sp);
@@ -880,6 +898,7 @@
sp->acct_req.pipe++;
sp->wrk->bereq = &sp->wrk->http[0];
+ http_Setup(sp->wrk->bereq, sp->wrk->ws);
http_FilterHeader(sp, HTTPH_R_PIPE);
VCL_pipe_method(sp);
Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c 2009-03-04 12:13:54 UTC (rev 3878)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2009-03-04 12:28:16 UTC (rev 3879)
@@ -344,9 +344,6 @@
w->lastused = NAN;
stats_clean = 0;
WS_Reset(w->ws, NULL);
- http_Setup(&w->http[0], w->ws);
- http_Setup(&w->http[1], w->ws);
- http_Setup(&w->http[2], w->ws);
w->bereq = NULL;
w->beresp1 = NULL;
w->beresp = NULL;
More information about the varnish-commit
mailing list