Commit 836c29e8 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

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.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@563 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 416b10d9
......@@ -258,6 +258,7 @@ FetchHeaders(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);
......@@ -276,6 +277,10 @@ FetchHeaders(struct sess *sp)
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment