[experimental-ims] 75739f8 Split http_Setup() into http_Setup() and http_Teardown()
Geoff Simmons
geoff at varnish-cache.org
Tue Feb 14 17:49:35 CET 2012
commit 75739f85b056a3c4d9a0e23382754490cba07910
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Feb 14 09:26:11 2012 +0000
Split http_Setup() into http_Setup() and http_Teardown()
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index eac81df..94c0284 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -818,6 +818,7 @@ void http_SetHeader(struct worker *w, unsigned vsl_id, struct http *to,
void http_SetH(const struct http *to, unsigned n, const char *fm);
void http_ForceGet(const struct http *to);
void http_Setup(struct http *ht, struct ws *ws);
+void http_Teardown(struct http *ht);
int http_GetHdr(const struct http *hp, const char *hdr, char **ptr);
int http_GetHdrData(const struct http *hp, const char *hdr,
const char *field, char **ptr);
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 45e069e..5e85542 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -294,7 +294,7 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
AZ(req->obj);
req->restarts++;
req->director = NULL;
- http_Setup(req->resp, NULL);
+ http_Teardown(req->resp);
sp->step = STP_RECV;
return (0);
default:
@@ -339,7 +339,7 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req)
assert(WRW_IsReleased(wrk));
(void)HSH_Deref(wrk, NULL, &req->obj);
- http_Setup(req->resp, NULL);
+ http_Teardown(req->resp);
sp->step = STP_DONE;
return (0);
}
@@ -487,8 +487,8 @@ cnt_error(struct sess *sp, struct worker *wrk, struct req *req)
if (req->obj == NULL) {
req->doclose = "Out of objects";
req->director = NULL;
- http_Setup(wrk->busyobj->beresp, NULL);
- http_Setup(wrk->busyobj->bereq, NULL);
+ http_Teardown(wrk->busyobj->beresp);
+ http_Teardown(wrk->busyobj->bereq);
sp->step = STP_DONE;
return(0);
}
@@ -533,7 +533,7 @@ cnt_error(struct sess *sp, struct worker *wrk, struct req *req)
assert(req->handling == VCL_RET_DELIVER);
req->err_code = 0;
req->err_reason = NULL;
- http_Setup(wrk->busyobj->bereq, NULL);
+ http_Teardown(wrk->busyobj->bereq);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
sp->step = STP_PREPRESP;
return (0);
@@ -897,8 +897,8 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
/* Use unmodified headers*/
i = FetchBody(wrk, req->obj);
- http_Setup(bo->bereq, NULL);
- http_Setup(bo->beresp, NULL);
+ http_Teardown(bo->bereq);
+ http_Teardown(bo->beresp);
bo->vfp = NULL;
assert(WRW_IsReleased(wrk));
AZ(bo->vbc);
@@ -953,8 +953,8 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req)
i = FetchBody(wrk, req->obj);
- http_Setup(wrk->busyobj->bereq, NULL);
- http_Setup(wrk->busyobj->beresp, NULL);
+ http_Teardown(wrk->busyobj->bereq);
+ http_Teardown(wrk->busyobj->beresp);
wrk->busyobj->vfp = NULL;
AZ(wrk->busyobj->vbc);
AN(req->director);
@@ -976,7 +976,7 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req)
assert(WRW_IsReleased(wrk));
(void)HSH_Deref(wrk, NULL, &req->obj);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
- http_Setup(req->resp, NULL);
+ http_Teardown(req->resp);
sp->step = STP_DONE;
return (0);
}
@@ -1247,7 +1247,7 @@ cnt_miss(struct sess *sp, struct worker *wrk, struct req *req)
AZ(HSH_Deref(wrk, req->objcore, NULL));
req->objcore = NULL;
- http_Setup(wrk->busyobj->bereq, NULL);
+ http_Teardown(wrk->busyobj->bereq);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
switch(req->handling) {
@@ -1304,7 +1304,7 @@ cnt_pass(struct sess *sp, struct worker *wrk, const struct req *req)
VCL_pass_method(sp);
if (req->handling == VCL_RET_ERROR) {
- http_Setup(wrk->busyobj->bereq, NULL);
+ http_Teardown(wrk->busyobj->bereq);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
sp->step = STP_ERROR;
return (0);
@@ -1364,7 +1364,7 @@ cnt_pipe(struct sess *sp, struct worker *wrk, const struct req *req)
PipeSession(sp);
assert(WRW_IsReleased(wrk));
- http_Setup(wrk->busyobj->bereq, NULL);
+ http_Teardown(wrk->busyobj->bereq);
VBO_DerefBusyObj(wrk, &wrk->busyobj);
sp->step = STP_DONE;
return (0);
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 314c05f..d947de1 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -132,6 +132,15 @@ HTTP_create(void *p, uint16_t nhttp)
void
http_Setup(struct http *hp, struct ws *ws)
{
+ http_Teardown(hp);
+ hp->ws = ws;
+}
+
+/*--------------------------------------------------------------------*/
+
+void
+http_Teardown(struct http *hp)
+{
uint16_t shd;
txt *hd;
unsigned char *hdf;
@@ -144,7 +153,6 @@ http_Setup(struct http *hp, struct ws *ws)
memset(hd, 0, sizeof *hd * shd);
memset(hdf, 0, sizeof *hdf * shd);
hp->magic = HTTP_MAGIC;
- hp->ws = ws;
hp->nhd = HTTP_HDR_FIRST;
hp->shd = shd;
hp->hd = hd;
More information about the varnish-commit
mailing list