varnishtest "ESI includes for pre HTTP/1.1 cannot used chunked encoding"

server s1 {
	rxreq
	expect req.url == "/foo/bar"
	txresp -body {
		<html>
		Before include
		<!--esi <esi:include src="body"/> -->
		After include
	}
	rxreq
	expect req.url == "/foo/body"
	txresp -body {
		Included file
	}
} -start

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

client c1 {
	txreq -url /foo/bar -proto HTTP/1.1
	rxresp
	expect resp.status == 200
	expect resp.bodylen == 67
	expect resp.http.Transfer-Encoding == "chunked"
} -run

client c1 {
	txreq -url /foo/bar -proto HTTP/1.0
	rxresp
	expect resp.status == 200
	expect resp.bodylen == 67
	expect resp.http.Transfer-Encoding == <undef>
	expect resp.http.Content-Length == <undef>
	expect resp.http.Connection == "close"
} -run

varnish v1 -expect esi_errors == 0
