Commit c65cc6f8 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Read expected final CRLF after chunked encoding data from backend.

Make "chunkedlen" test server command output final CRLF after chunked data.
Update a couple of test cases to output the final CRLF.

Fixes: #780



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5476 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent baa2311d
......@@ -207,6 +207,15 @@ fetch_chunked(struct sess *sp, struct http_conn *htc)
q = bp = buf + v;
}
/* Expect a CRLF to trail the chunks */
i = HTC_Read(htc, buf, 1);
if (i == 1 && buf[0] == '\r')
i = HTC_Read(htc, buf, 1);
if (i != 1 || buf[0] != '\n') {
WSP(sp, SLT_FetchError, "chunked missing trailing crlf");
return (1); /* Accept fetch, but do not reuse connection */
}
if (st != NULL && st->len == 0) {
VTAILQ_REMOVE(&sp->obj->store, st, list);
STV_free(st);
......
......@@ -10,6 +10,7 @@ server s1 {
send "\r\n"
send "00000004\r\n1234\r\n"
send "00000000\r\n"
send "\r\n"
rxreq
expect req.url == "/foo"
......
......@@ -10,6 +10,7 @@ server s1 {
send "004\r\n1234\r\n"
send "000000000000000000001\r\n@\r\n"
send "00000000\r\n"
send "\r\n"
} -start
varnish v1 -vcl+backend {} -start
......
......@@ -778,7 +778,7 @@ cmd_http_chunkedlen(CMD_ARGS)
vsb_printf(hp->vsb, "%x%s", v, nl);
vsb_printf(hp->vsb, "%*.*s%s", v, v, buf, nl);
}
vsb_printf(hp->vsb, "%x%s", 0, nl);
vsb_printf(hp->vsb, "%x%s%s", 0, nl, nl);
http_write(hp, 4, "chunked");
}
......
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