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

Make the "chunkedlen" word work like "chunked" and not send the

final zero-length chunk automatically, allowing us to easily
generate specifically constructed messages this way.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5752 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent df32edd7
......@@ -9,6 +9,7 @@ server s1 {
send "\r\n"
# This is chunksize (128k) + 2 to force to chunks to be allocated
chunkedlen 131074
chunkedlen 0
} -start
varnish v1 -vcl+backend {
......
......@@ -6,6 +6,7 @@ server s1 {
rxreq
txresp -nolen -hdr "Transfer-encoding: chunked"
chunkedlen 4096
chunkedlen 0
} -start
varnish v1 \
......
......@@ -883,17 +883,21 @@ cmd_http_chunkedlen(CMD_ARGS)
len = atoi(av[1]);
for (u = 0; u < sizeof buf; u++)
buf[u] = (u & 7) + '0';
for (u = 0; u < len; u += 16384) {
v = len - u;
if (v > sizeof buf)
v = sizeof buf;
vsb_printf(hp->vsb, "%x%s", v, nl);
vsb_printf(hp->vsb, "%*.*s%s", v, v, buf, nl);
if (len == 0) {
vsb_printf(hp->vsb, "0%s%s", nl, nl);
} else {
for (u = 0; u < sizeof buf; u++)
buf[u] = (u & 7) + '0';
vsb_printf(hp->vsb, "%x%s", len, nl);
for (u = 0; u < len; u += v) {
v = len - u;
if (v > sizeof buf)
v = sizeof buf;
vsb_bcat(hp->vsb, buf, v);
}
vsb_printf(hp->vsb, "%s", 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