Commit ca282e94 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Implement HTTP continuation lines.

Fixes #494



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4036 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 06349410
......@@ -326,12 +326,29 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p, txt t)
hp->conds = 0;
r = NULL; /* For FlexeLint */
for (; p < t.e; p = r) {
/* XXX: handle continuation lines */
q = strchr(p, '\n');
assert(q != NULL);
r = q + 1;
if (q > p && q[-1] == '\r')
q--;
/* Find end of next header */
q = r = p;
while (r < t.e) {
if (!vct_iscrlf(*r)) {
r++;
continue;
}
q = r;
assert(r < t.e);
r += vct_skipcrlf(r);
if (r >= t.e)
break;
/* If line does not continue: got it. */
if (!vct_issp(*r))
break;
/* Clear line continuation LWS to spaces */
while (vct_islws(*q))
*q++ = ' ';
}
/* Empty header = end of headers */
if (p == q)
break;
......
# $Id$
test "HTTP continuation lines"
#NB: careful about spaces and tabs in this test.
server s1 {
rxreq
txresp -hdr {Foo: bar,
barf: fail} -body "xxx"
} -start
varnish v1 -vcl+backend {
sub vcl_fetch {
set beresp.http.bar = beresp.http.foo;
remove beresp.http.foo;
}
} -start
client c1 {
txreq
rxresp
expect resp.http.bar == "bar, barf: fail"
expect resp.http.barf == resp.http.barf
expect resp.http.foo == resp.http.foo
} -run
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