From 359e2e00627cc7f5a7cc8bf2f545ff7856b8f255 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 27 Feb 2009 12:17:52 +0000 Subject: [PATCH] Move the http_conn into the bereq. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3836 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 1 + varnish-cache/bin/varnishd/cache_fetch.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index d8fd2f5a..3aeeaa24 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -243,6 +243,7 @@ struct bereq { VTAILQ_ENTRY(bereq) list; struct ws ws[1]; struct http http[2]; + struct http_conn htc[1]; }; /* Storage -----------------------------------------------------------*/ diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index 3c8820ae..ef50042c 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -315,7 +315,6 @@ FetchHdr(struct sess *sp) char *b; struct http *hp; struct bereq *bereq; - struct http_conn htc[1]; int i; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); @@ -368,10 +367,10 @@ FetchHdr(struct sess *sp) /* Receive response */ - HTC_Init(htc, bereq->ws, vc->fd); + HTC_Init(bereq->htc, bereq->ws, vc->fd); TCP_set_read_timeout(vc->fd, sp->first_byte_timeout); do { - i = HTC_Rx(htc); + i = HTC_Rx(bereq->htc); TCP_set_read_timeout(vc->fd, sp->between_bytes_timeout); } while (i == 0); @@ -384,7 +383,7 @@ FetchHdr(struct sess *sp) hp = &bereq->http[1]; - if (http_DissectResponse(sp->wrk, htc, hp)) { + if (http_DissectResponse(sp->wrk, bereq->htc, hp)) { VBE_ClosedFd(sp); /* XXX: other cleanup ? */ return (__LINE__); @@ -403,7 +402,6 @@ FetchBody(struct sess *sp) struct http *hp, *hp2; struct storage *st; int mklen, is_head; - struct http_conn htc[1]; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); @@ -437,10 +435,10 @@ FetchBody(struct sess *sp) if (is_head) { /* nothing */ } else if (http_GetHdr(hp, H_Content_Length, &b)) { - cls = fetch_straight(sp, htc, b); + cls = fetch_straight(sp, sp->bereq->htc, b); mklen = 1; } else if (http_HdrIs(hp, H_Transfer_Encoding, "chunked")) { - cls = fetch_chunked(sp, htc); + cls = fetch_chunked(sp, sp->bereq->htc); mklen = 1; } else if (http_GetHdr(hp, H_Transfer_Encoding, &b)) { /* XXX: AUGH! */ @@ -459,13 +457,13 @@ FetchBody(struct sess *sp) * If we have connection closed, it is safe to read what * comes in any case. */ - cls = fetch_eof(sp, htc); + cls = fetch_eof(sp, sp->bereq->htc); mklen = 1; } else if (hp->protover < 1.1) { /* * With no Connection header, assume EOF */ - cls = fetch_eof(sp, htc); + cls = fetch_eof(sp, sp->bereq->htc); mklen = 1; } else { /* -- 2.39.5