vtest "Check chunked encoding from backend works"

server s1 {
	rxreq
	expect req.url == "/bar"
	send "HTTP/1.1 200 OK\r\n"
	send "Transfer-encoding: chunked\r\n"
	send "\r\n"
	send "00000004\r\n1234\r\n"
	send "00000000\r\n"
	send "\r\n"

	rxreq
	expect req.url == "/foo"
	send "HTTP/1.1 200 OK\r\n"
	send "Transfer-encoding: chunked\r\n"
	send "\r\n"
	send "00000004\r\n1234\r\n"
	chunked "1234"
	chunked ""
} -start

vinyl v1 -vcl+backend {} -start

client c1 {
	txreq -url "/bar"
	rxresp
	expect resp.status == 200
	expect resp.bodylen == "4"
	txreq -url "/foo"
	rxresp
	expect resp.status == 200
	expect resp.bodylen == "8"
} -run
