From: phk Date: Thu, 20 Sep 2007 10:44:18 +0000 (+0000) Subject: Fix a brain-o in my last commit. "cls" is a flag for closing the fd, X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d6c48bc46c544c2f1a66c64656aec64bce82919;p=varnish Fix a brain-o in my last commit. "cls" is a flag for closing the fd, not for generating Content-Length: header. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1970 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index bbb2bcc3..9e6d8ba8 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -263,7 +263,7 @@ Fetch(struct sess *sp) struct http *hp, *hp2; struct storage *st; struct bereq *bereq; - int len; + int len, mklen; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); @@ -340,11 +340,14 @@ Fetch(struct sess *sp) /* Determine if we have a body or not */ cls = 0; - if (http_GetHdr(hp, H_Content_Length, &b)) + mklen = 0; + if (http_GetHdr(hp, H_Content_Length, &b)) { cls = fetch_straight(sp, vc->fd, hp, b); - else if (http_HdrIs(hp, H_Transfer_Encoding, "chunked")) + mklen = 1; + } else if (http_HdrIs(hp, H_Transfer_Encoding, "chunked")) { cls = fetch_chunked(sp, vc->fd, hp); - else if (http_GetHdr(hp, H_Transfer_Encoding, &b)) { + mklen = 1; + } else if (http_GetHdr(hp, H_Transfer_Encoding, &b)) { /* XXX: AUGH! */ VSL(SLT_Debug, vc->fd, "Invalid Transfer-Encoding"); VBE_ClosedFd(sp->wrk, vc); @@ -353,13 +356,14 @@ Fetch(struct sess *sp) switch (http_GetStatus(hp)) { case 200: cls = fetch_eof(sp, vc->fd, hp); + mklen = 1; break; default: break; } } - if (cls > 0) + if (mklen > 0) http_PrintfHeader(sp->wrk, sp->fd, hp2, "Content-Length: %u", sp->obj->len);