Commit ef6f15e5 authored by Lasse Karstensen's avatar Lasse Karstensen

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
parent f8cdd8fc
......@@ -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;
......
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
......@@ -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.
============================================
......
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