[4.0] ef6f15e Allow invalid headers in 304 backend responses.
Lasse Karstensen
lkarsten at varnish-software.com
Mon Oct 19 17:19:17 CEST 2015
commit ef6f15e5521829d60cb44233b8d5fe5ad29f3620
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date: Mon Oct 19 17:01:20 2015 +0200
Allow invalid headers in 304 backend responses.
Allow the backend server to send headers lacking ":"/colon in
them when responding to a conditional request yielding a 304 response.
In master/4.1 such responses are aborted as invalid. The backend is
clearly not feeling well.
Since we've accepted it nicely for 200 responses so far in Varnish 4.0,
continue that trend also for 304s.
Fixes: #1598
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 572d987..24e4444 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -805,7 +805,8 @@ http_Merge(const struct http *fm, struct http *to, int not_ce)
}
for (v = HTTP_HDR_FIRST; v < to->nhd; v++) {
p = strchr(to->hd[v].b, ':');
- AN(p);
+ if (!p)
+ p = 0;
u = http_findhdr(fm, p - to->hd[v].b, to->hd[v].b);
if (u)
fm->hdf[u] &= ~HDF_MARKER;
diff --git a/bin/varnishtest/tests/r01598.vtc b/bin/varnishtest/tests/r01598.vtc
new file mode 100644
index 0000000..3264e9d
--- /dev/null
+++ b/bin/varnishtest/tests/r01598.vtc
@@ -0,0 +1,39 @@
+varnishtest "#1598 - Missing ':' in server response headers with backend IMS"
+
+server s1 {
+ rxreq
+ txresp -hdr "ETag: \"tag\"" -hdr "foo"
+
+ rxreq
+ expect req.http.if-none-match == "\"tag\""
+ txresp -status 304 -nolen \
+ -hdr "ETag: \"tag\"" \
+ -hdr "foo"
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_backend_response {
+ set beresp.ttl = 1s;
+ set beresp.grace = 0s;
+ set beresp.keep = 60s;
+ }
+} -start
+
+varnish v1 -cliok "param.set debug +syncvsl"
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.status == 200
+ # varnishtest doesn't accept the faulty header, and there
+ # is no "resp.headers" to do a regex match against.
+ expect resp.http.foo == <undef>
+} -run
+
+delay 1
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.status == 200
+} -run
diff --git a/doc/changes.rst b/doc/changes.rst
index 2ecd3af..fcd83df 100644
--- a/doc/changes.rst
+++ b/doc/changes.rst
@@ -17,12 +17,14 @@ Bugs fixed
.. _1691: https://www.varnish-cache.org/trac/ticket/1691
.. _1688: https://www.varnish-cache.org/trac/ticket/1688
.. _1602: https://www.varnish-cache.org/trac/ticket/1602
+.. _1598: https://www.varnish-cache.org/trac/ticket/1598
- 1744_ - Update the users guide to for new -sfile syntax
- 1742_ - Document varnishlog -w/-r with more details
- 1691_ - Fail fetch on malformed Content-Length header
- 1688_ - Add a VDP_pretend_gzip for use with synth bodies in ESI includes with gzip
- 1602_ - Deal with known zero length objects properly when handling do_gzip/do_gunzip
+- 1598_ - Allow invalid headers in 304 backend responses.
============================================
More information about the varnish-commit
mailing list