varnishtest "ESI:remove"


server s1 {
	rxreq
	txresp -gzipbody {
		<esi:remove>
		This is a test: Unseen University
		<esi:include src="trick question">
		<!--esi XXX -->
		</esi:remove>
		<esX>This is a test: Hello world
	}
} -start

varnish v1 -vcl+backend {
	sub vcl_backend_response {
		set beresp.do_esi = true;
		set beresp.do_gunzip = true;
	}
} -start

varnish v1 -cliok "param.set http_gzip_support true"

logexpect l1 -v v1 -g vxid {
	expect * * Fetch_Body
	expect 0 = ESI_xmlerror {^ERR after 3 ESI 1.0 <esi:include> element nested in <esi:remove>$}
	expect 0 = ESI_xmlerror {^ERR after 3 ESI 1.0 Nested <!--esi element in <esi:remove>$}
	expect 0 = Gzip         {^U}
	expect 0 = BackendClose
} -start

client c1 {
	txreq
	rxresp
	expect resp.status == 200
	expect resp.bodylen == 40
}

client c1 -run
varnish v1 -expect esi_errors == 2
logexpect l1 -wait
