r563 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Sat Jul 22 18:55:17 CEST 2006
Author: phk
Date: 2006-07-22 18:55:17 +0200 (Sat, 22 Jul 2006)
New Revision: 563
Modified:
trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
Make sure there always is a Host: header in fetch requests.
We fill it in with backend.hostname, but this may not be optimal
(direct IP# etc etc) so VCL should be able to override it.
Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-07-22 16:26:45 UTC (rev 562)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-07-22 16:55:17 UTC (rev 563)
@@ -258,6 +258,7 @@
int i;
struct vbe_conn *vc;
struct worker *w;
+ char *b;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
@@ -276,6 +277,10 @@
http_GetReq(vc->fd, vc->http, sp->http);
http_FilterHeader(vc->fd, vc->http, sp->http, HTTPH_R_FETCH);
http_PrintfHeader(vc->fd, vc->http, "X-Varnish: %u", sp->xid);
+ if (!http_GetHdr(vc->http, H_Host, &b)) {
+ http_PrintfHeader(vc->fd, vc->http, "Host: %s",
+ sp->backend->hostname);
+ }
sp->t_req = time(NULL);
WRK_Reset(w, &vc->fd);
More information about the varnish-commit
mailing list