varnishtest "Test case for #1037"

server s1 {
	rxreq
	# Send a bodylen of 1,5M, which will exceed cache space of 1M
	non_fatal
	txresp -nolen -hdr "Transfer-encoding: chunked"
	chunked {<HTML>}
	chunkedlen 500000
	chunked {<esi:remove>}
	chunkedlen 500000
	chunked {</esi:remove>}
	chunkedlen 500000
	chunkedlen 0
} -start

varnish v1 -arg "-sdefault,1M" -arg "-pgzip_level=0" -vcl+backend {
	sub vcl_backend_response {
		set beresp.do_esi = true;
		set beresp.do_gzip = true;
	}
} -start

client c1 {
	txreq
	rxresp
	expect resp.status == "503"
} -run

