Commit 5647c265 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move the "need_host_hdr" test to cache_fetch.c

parent 8e8a8942
...@@ -815,8 +815,7 @@ void EXP_NukeLRU(struct worker *wrk, struct vsl_log *vsl, struct lru *lru); ...@@ -815,8 +815,7 @@ void EXP_NukeLRU(struct worker *wrk, struct vsl_log *vsl, struct lru *lru);
struct storage *FetchStorage(struct busyobj *, ssize_t sz); struct storage *FetchStorage(struct busyobj *, ssize_t sz);
int FetchError(struct busyobj *, const char *error); int FetchError(struct busyobj *, const char *error);
int FetchError2(struct busyobj *, const char *error, const char *more); int FetchError2(struct busyobj *, const char *error, const char *more);
int FetchHdr(struct worker *wrk, struct busyobj *bo, struct req *req, int FetchHdr(struct worker *wrk, struct busyobj *bo, struct req *req);
int need_host_hdr);
void FetchBody(struct worker *w, void *bo); void FetchBody(struct worker *w, void *bo);
void Fetch_Init(void); void Fetch_Init(void);
......
...@@ -357,8 +357,7 @@ fetch_iter_req_body(struct req *req, void *priv, void *ptr, size_t l) ...@@ -357,8 +357,7 @@ fetch_iter_req_body(struct req *req, void *priv, void *ptr, size_t l)
*/ */
int int
FetchHdr(struct worker *wrk, struct busyobj *bo, struct req *req, FetchHdr(struct worker *wrk, struct busyobj *bo, struct req *req)
int need_host_hdr)
{ {
struct vbc *vc; struct vbc *vc;
struct http *hp; struct http *hp;
...@@ -366,6 +365,7 @@ FetchHdr(struct worker *wrk, struct busyobj *bo, struct req *req, ...@@ -366,6 +365,7 @@ FetchHdr(struct worker *wrk, struct busyobj *bo, struct req *req,
int retry = -1; int retry = -1;
int i, first; int i, first;
struct http_conn *htc; struct http_conn *htc;
int need_host_hdr;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_ORNULL(req, REQ_MAGIC); CHECK_OBJ_ORNULL(req, REQ_MAGIC);
...@@ -374,6 +374,8 @@ FetchHdr(struct worker *wrk, struct busyobj *bo, struct req *req, ...@@ -374,6 +374,8 @@ FetchHdr(struct worker *wrk, struct busyobj *bo, struct req *req,
AN(bo->director); AN(bo->director);
need_host_hdr = !http_GetHdr(bo->bereq, H_Host, NULL);
hp = bo->bereq; hp = bo->bereq;
bo->vbc = VDI_GetFd(NULL, bo); bo->vbc = VDI_GetFd(NULL, bo);
......
...@@ -350,7 +350,7 @@ DOT fetch -> fetchbody [style=bold,color=blue] ...@@ -350,7 +350,7 @@ DOT fetch -> fetchbody [style=bold,color=blue]
static enum req_fsm_nxt static enum req_fsm_nxt
cnt_fetch(struct worker *wrk, struct req *req) cnt_fetch(struct worker *wrk, struct req *req)
{ {
int i, need_host_hdr; int i;
struct busyobj *bo; struct busyobj *bo;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
...@@ -367,12 +367,9 @@ cnt_fetch(struct worker *wrk, struct req *req) ...@@ -367,12 +367,9 @@ cnt_fetch(struct worker *wrk, struct req *req)
HTTP_Setup(bo->beresp, bo->ws, bo->vsl, HTTP_Beresp); HTTP_Setup(bo->beresp, bo->ws, bo->vsl, HTTP_Beresp);
need_host_hdr = !http_GetHdr(bo->bereq, H_Host, NULL);
req->acct_req.fetch++; req->acct_req.fetch++;
i = FetchHdr(wrk, bo, req->objcore->objhead == NULL ? req : NULL, i = FetchHdr(wrk, bo, req->objcore->objhead == NULL ? req : NULL);
need_host_hdr);
/* /*
* If we recycle a backend connection, there is a finite chance * If we recycle a backend connection, there is a finite chance
* that the backend closed it before we get a request to it. * that the backend closed it before we get a request to it.
...@@ -381,7 +378,7 @@ cnt_fetch(struct worker *wrk, struct req *req) ...@@ -381,7 +378,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
if (i == 1) { if (i == 1) {
VSC_C_main->backend_retry++; VSC_C_main->backend_retry++;
i = FetchHdr(wrk, bo, i = FetchHdr(wrk, bo,
req->objcore->objhead == NULL ? req : NULL, need_host_hdr); req->objcore->objhead == NULL ? req : NULL);
} }
if (req->objcore->objhead != NULL) if (req->objcore->objhead != NULL)
......
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