[master] 15d6c83 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".
Poul-Henning Kamp
phk at FreeBSD.org
Tue Dec 17 12:51:26 CET 2013
commit 15d6c830476bda06c40dbb70ee4bd6be38d6e93e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Dec 17 11:50:13 2013 +0000
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)
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 16067b2..e7ef1bb 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -140,6 +140,22 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
/*--------------------------------------------------------------------
*/
+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");
+}
+
+/*--------------------------------------------------------------------
+ */
+
static enum fetch_step
vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
{
@@ -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);
}
More information about the varnish-commit
mailing list