r5752 - in trunk/varnish-cache/bin/varnishtest: . tests
phk at varnish-cache.org
phk at varnish-cache.org
Fri Jan 14 20:38:48 CET 2011
Author: phk
Date: 2011-01-14 20:38:13 +0100 (Fri, 14 Jan 2011)
New Revision: 5752
Modified:
trunk/varnish-cache/bin/varnishtest/tests/r00694.vtc
trunk/varnish-cache/bin/varnishtest/tests/r00776.vtc
trunk/varnish-cache/bin/varnishtest/vtc_http.c
Log:
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.
Modified: trunk/varnish-cache/bin/varnishtest/tests/r00694.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00694.vtc 2011-01-14 15:41:43 UTC (rev 5751)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00694.vtc 2011-01-14 19:38:13 UTC (rev 5752)
@@ -9,6 +9,7 @@
send "\r\n"
# This is chunksize (128k) + 2 to force to chunks to be allocated
chunkedlen 131074
+ chunkedlen 0
} -start
varnish v1 -vcl+backend {
Modified: trunk/varnish-cache/bin/varnishtest/tests/r00776.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00776.vtc 2011-01-14 15:41:43 UTC (rev 5751)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00776.vtc 2011-01-14 19:38:13 UTC (rev 5752)
@@ -6,6 +6,7 @@
rxreq
txresp -nolen -hdr "Transfer-encoding: chunked"
chunkedlen 4096
+ chunkedlen 0
} -start
varnish v1 \
Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2011-01-14 15:41:43 UTC (rev 5751)
+++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2011-01-14 19:38:13 UTC (rev 5752)
@@ -883,17 +883,21 @@
len = atoi(av[1]);
- for (u = 0; u < sizeof buf; u++)
- buf[u] = (u & 7) + '0';
+ 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';
- 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);
+ 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");
}
More information about the varnish-commit
mailing list