vtest "client close in ESI delivery"

barrier b1 cond 2
barrier b2 cond 2

server s1 {
	rxreq
	txresp -body {
		<esi:include src="/foo"/>
		<esi:include src="/bar"/>
		<esi:include src="/barf"/>
	}

	rxreq
	expect req.url == "/foo"
	barrier b1 sync
	barrier b2 sync
	txresp -body "[foo]"

	rxreq
	expect req.url == "/bar"
	txresp -body "[bar]"

	rxreq
	expect req.url == "/barf"
	txresp -body "[barf]"
} -start

vinyl v1 -vcl+backend {
	sub vcl_backend_response {
		if (bereq.url == "/") {
			set beresp.do_esi = true;
		}
	}
} -start

client c1 {
	txreq
	barrier b1 sync
} -run

client c1 {
	barrier b2 sync
	txreq
	rxresp
} -run
