From: phk Date: Mon, 2 Oct 2006 14:08:49 +0000 (+0000) Subject: Also add missing Host: headers for Pass & Pipe X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1a52d034c2b12ddaa8bd3d0c00beaa0fb69cc4d;p=varnish Also add missing Host: headers for Pass & Pipe git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1134 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_pass.c b/varnish-cache/bin/varnishd/cache_pass.c index d78c7681..694e6fa2 100644 --- a/varnish-cache/bin/varnishd/cache_pass.c +++ b/varnish-cache/bin/varnishd/cache_pass.c @@ -226,6 +226,7 @@ PassSession(struct sess *sp) int i; struct vbe_conn *vc; struct worker *w; + char *b; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC); @@ -238,6 +239,10 @@ PassSession(struct sess *sp) http_CopyReq(w, vc->fd, vc->http, sp->http); http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_PASS); http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid); + if (!http_GetHdr(vc->http, H_Host, &b)) { + http_PrintfHeader(w, vc->fd, vc->http, "Host: %s", + sp->backend->hostname); + } WRK_Reset(w, &vc->fd); http_Write(w, vc->http, 0); i = WRK_Flush(w); diff --git a/varnish-cache/bin/varnishd/cache_pipe.c b/varnish-cache/bin/varnishd/cache_pipe.c index 49650544..5bf99156 100644 --- a/varnish-cache/bin/varnishd/cache_pipe.c +++ b/varnish-cache/bin/varnishd/cache_pipe.c @@ -90,6 +90,10 @@ PipeSession(struct sess *sp) http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid); http_PrintfHeader(w, vc->fd, vc->http, "X-Forwarded-for: %s", sp->addr); + if (!http_GetHdr(vc->http, H_Host, &b)) { + http_PrintfHeader(w, vc->fd, vc->http, "Host: %s", + sp->backend->hostname); + } WRK_Reset(w, &vc->fd); http_Write(w, vc->http, 0);