From 70e7bdbcab3689a553693e2ec69a218fd1475e39 Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 19 Aug 2008 19:34:53 +0000 Subject: [PATCH] Fix ticket 292: Make sure the "deleted by Connection:" flag sticks with its header around. Found and nailed by: Adrian Otto git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3110 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_http.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index 6eb222f1..eff99611 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -604,6 +604,7 @@ http_copyheader(struct worker *w, int fd, struct http *to, const struct http *fm Tcheck(fm->hd[n]); if (to->nhd < HTTP_HDR_MAX) { to->hd[to->nhd] = fm->hd[n]; + to->hdf[to->nhd] = 0; to->nhd++; } else { VSL_stats->losthdr++; @@ -736,10 +737,12 @@ http_PutField(struct worker *w, int fd, struct http *to, int field, const char * WSL(w, SLT_LostHeader, fd, "%s", string); to->hd[field].b = NULL; to->hd[field].e = NULL; + to->hdf[field] = 0; } else { memcpy(p, string, l + 1); to->hd[field].b = p; to->hd[field].e = p + l; + to->hdf[field] = 0; } } @@ -786,6 +789,7 @@ http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, .. } else { to->hd[to->nhd].b = to->ws->f; to->hd[to->nhd].e = to->ws->f + n; + to->hdf[to->nhd] = 0; WS_Release(to->ws, n + 1); to->nhd++; } @@ -800,8 +804,10 @@ http_Unset(struct http *hp, const char *hdr) for (v = u = HTTP_HDR_FIRST; u < hp->nhd; u++) { if (http_IsHdr(&hp->hd[u], hdr)) continue; - if (v != u) + if (v != u) { memcpy(&hp->hd[v], &hp->hd[u], sizeof hp->hd[v]); + memcpy(&hp->hdf[v], &hp->hdf[u], sizeof hp->hdf[v]); + } v++; } hp->nhd = v; -- 2.39.5