Commit 44c0c6ed authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Collect all aspect of resp.* creation together.

parent e0c87d41
...@@ -267,14 +267,6 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -267,14 +267,6 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
HTTP_Setup(req->resp, req->ws, req->vsl, HTTP_Resp); HTTP_Setup(req->resp, req->ws, req->vsl, HTTP_Resp);
RES_BuildHttp(sp); RES_BuildHttp(sp);
if (req->obj->response == 200
&& req->http->conds && RFC2616_Do_Cond(sp)) {
req->wantbody = 0;
http_SetResp(req->resp, "HTTP/1.1", 304, "Not Modified");
http_Unset(req->resp, H_Content_Length);
http_Unset(req->resp, H_Transfer_Encoding);
}
VCL_deliver_method(sp); VCL_deliver_method(sp);
switch (req->handling) { switch (req->handling) {
case VCL_RET_DELIVER: case VCL_RET_DELIVER:
......
...@@ -124,7 +124,15 @@ RES_BuildHttp(const struct sess *sp) ...@@ -124,7 +124,15 @@ RES_BuildHttp(const struct sess *sp)
http_SetHeader(req->resp, "Accept-Ranges: bytes"); http_SetHeader(req->resp, "Accept-Ranges: bytes");
} }
if (req->res_mode & RES_CHUNKED) if (req->res_mode & RES_GUNZIP)
http_Unset(req->resp, H_Content_Encoding);
if (req->obj->response == 200
&& req->http->conds && RFC2616_Do_Cond(sp)) {
req->wantbody = 0;
http_SetResp(req->resp, "HTTP/1.1", 304, "Not Modified");
http_Unset(req->resp, H_Content_Length);
} else if (req->res_mode & RES_CHUNKED)
http_SetHeader(req->resp, "Transfer-Encoding: chunked"); http_SetHeader(req->resp, "Transfer-Encoding: chunked");
http_Unset(req->resp, H_Date); http_Unset(req->resp, H_Date);
...@@ -248,12 +256,6 @@ RES_WriteObj(struct sess *sp) ...@@ -248,12 +256,6 @@ RES_WriteObj(struct sess *sp)
http_GetHdr(req->http, H_Range, &r)) http_GetHdr(req->http, H_Range, &r))
res_dorange(sp, r, &low, &high); res_dorange(sp, r, &low, &high);
/*
* Always remove C-E if client don't grok it
*/
if (req->res_mode & RES_GUNZIP)
http_Unset(req->resp, H_Content_Encoding);
WRW_Reserve(sp->wrk, &sp->fd, sp->req->vsl, sp->req->t_resp); WRW_Reserve(sp->wrk, &sp->fd, sp->req->vsl, sp->req->t_resp);
/* /*
......
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