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