varnishtest "Check rxrespbody -max"

server s1 {
	rxreq
	txresp -bodylen 65536
	rxreq
	txresp
} -start

server s2 {
	rxreq
	txresp -nolen -hdr "Transfer-Encoding: chunked"
	chunkedlen 8192
	chunkedlen 4096
	chunkedlen 4096
	chunkedlen 16384
	chunkedlen 16384
	chunkedlen 16384
	chunkedlen 0
	rxreq
	txresp
} -start

server s3 {
	rxreq
	txresp -nolen -bodylen 65536
} -start

client c1 -connect ${s1_sock} {
	txreq
	rxresphdrs
	rxrespbody -max 8192
	expect resp.bodylen == 8192
	rxrespbody -max 8192
	expect resp.bodylen == 16384
	rxrespbody
	expect resp.bodylen == 65536
	txreq
	rxresp
} -run

client c2 -connect ${s2_sock} {
	txreq
	rxresphdrs
	rxrespbody -max 8192
	expect resp.bodylen == 8192
	rxrespbody -max 8192
	expect resp.bodylen == 16384
	rxrespbody
	expect resp.bodylen == 65536
	txreq
	rxresp
} -run

client c3 -connect ${s3_sock} {
	txreq
	rxresphdrs
	rxrespbody -max 8192
	expect resp.bodylen == 8192
	rxrespbody -max 8192
	expect resp.bodylen == 16384
	rxrespbody
	expect resp.bodylen == 65536
} -run
