vtest "ESI:remove"


server s1 {
	rxreq
	txresp -body {
		<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

vinyl v1 -vcl+backend {
	sub vcl_backend_response {
		set beresp.do_esi = true;
	}
	sub vcl_deliver {
		set resp.http.can_esi = obj.can_esi;
	}
} -start

logexpect l1 -v v1 -g raw {
	expect * * 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>}
} -start

client c1 {
	txreq
	rxresp
	expect resp.status == 200
	expect resp.bodylen == 40
	expect resp.http.can_esi == "true"
}

client c1 -run
logexpect l1 -wait
vinyl v1 -expect esi_errors == 2
vinyl v1 -expect MAIN.s_resp_bodybytes == 40
