From 93a6f3ed8532f0627ea6dd0df9c56f2a852c058e Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 27 Feb 2009 11:36:16 +0000 Subject: [PATCH] Don't pollute bereq.* in vcl_fetch{} with the reply git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3833 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 2 +- varnish-cache/bin/varnishd/cache_backend.c | 3 ++- varnish-cache/bin/varnishd/cache_fetch.c | 9 ++++++++- varnish-cache/bin/varnishd/cache_vrt.c | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 0993301d..63c230fd 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -242,7 +242,7 @@ struct bereq { #define BEREQ_MAGIC 0x3b6d250c VTAILQ_ENTRY(bereq) list; struct ws ws[1]; - struct http http[1]; + struct http http[2]; }; /* Storage -----------------------------------------------------------*/ diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index e691b534..3637fedd 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -163,7 +163,8 @@ VBE_new_bereq(void) WS_Init(bereq->ws, "bereq", bereq + 1, len); VSL_stats->n_bereq++; } - http_Setup(bereq->http, bereq->ws); + http_Setup(&bereq->http[0], bereq->ws); + http_Setup(&bereq->http[1], bereq->ws); return (bereq); } diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index fd08aecb..03e928c5 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -329,9 +329,12 @@ Fetch(struct sess *sp) if (sp->obj->objcore != NULL) /* pass has no objcore */ AN(ObjIsBusy(sp->obj)); AN(sp->bereq); + + /* Transmit request */ + w = sp->wrk; bereq = sp->bereq; - hp = bereq->http; + hp = &bereq->http[0]; is_head = (strcasecmp(http_GetReq(hp), "head") == 0); sp->obj->xid = sp->xid; @@ -371,6 +374,8 @@ Fetch(struct sess *sp) /* XXX is this the right place? */ VSL_stats->backend_req++; + /* Receive response */ + HTC_Init(htc, bereq->ws, vc->fd); TCP_set_read_timeout(vc->fd, sp->first_byte_timeout); do { @@ -385,6 +390,8 @@ Fetch(struct sess *sp) return (__LINE__); } + hp = &bereq->http[1]; + if (http_DissectResponse(sp->wrk, htc, hp)) { VBE_ClosedFd(sp); /* XXX: other cleanup ? */ diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index aacfe39d..bfddf0c7 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -100,7 +100,7 @@ vrt_selecthttp(const struct sess *sp, enum gethdr_e where) hp = sp->http; break; case HDR_BEREQ: - hp = sp->bereq->http; + hp = &sp->bereq->http[0]; break; case HDR_RESP: hp = sp->http; -- 2.39.5