varnishtest "chunked req.body"

server s1 {
	rxreq
	expect req.bodylen == 106
	txresp -body "ABCD"
	rxreq
	expect req.bodylen == 108
	txresp -body "ABCDE"
} -start

varnish v1 -vcl+backend {
} -start

varnish v1 -cliok "param.set debug +syncvsl"

client c1 {
	txreq -req POST -nolen -hdr "Transfer-encoding: chunked"
	chunked {BLA}
	delay .2
	chunkedlen 100
	delay .2
	chunked {FOO}
	delay .2
	chunkedlen 0
	rxresp
	expect resp.status == 200
	expect resp.bodylen == 4
} -run

delay .2

varnish v1 -vcl+backend {
	import std;

	sub vcl_recv {
		if (std.cache_req_body(110B)) {
		}
	}
}

client c1 {
	txreq -req POST -nolen -hdr "Transfer-encoding: chunked"
	chunked {BLAS}
	delay .2
	chunkedlen 110
	expect_close
} -run
