Commit 15d6c830 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

When we get a bogus reply from a backend, for instance with too many

headers, we need to purge all traces of it, before we construct our
503 response, otherwise we risk failing to set important headers,
such as "Connection: close".

Fixes #416
(again)
parent 627060b4
......@@ -137,6 +137,22 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
return (F_STP_FETCHHDR);
}
/*--------------------------------------------------------------------
*/
static void
make_it_503(struct busyobj *bo)
{
HTTP_Setup(bo->beresp, bo->ws, bo->vsl, HTTP_Beresp);
bo->err_code = 503;
http_SetH(bo->beresp, HTTP_HDR_PROTO, "HTTP/1.1");
http_SetResp(bo->beresp,
"HTTP/1.1", 503, "Backend fetch failed");
http_SetHeader(bo->beresp, "Content-Length: 0");
http_SetHeader(bo->beresp, "Connection: close");
}
/*--------------------------------------------------------------------
*/
......@@ -175,12 +191,7 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
if (i) {
AZ(bo->vbc);
bo->err_code = 503;
http_SetH(bo->beresp, HTTP_HDR_PROTO, "HTTP/1.1");
http_SetResp(bo->beresp,
"HTTP/1.1", 503, "Backend fetch failed");
http_SetHeader(bo->beresp, "Content-Length: 0");
http_SetHeader(bo->beresp, "Connection: close");
make_it_503(bo);
} else {
AN(bo->vbc);
}
......
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