vtest "ESI ability to stitch gzip files together"


server s1 {
	rxreq
	expect req.http.accept-encoding == gzip
	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

vinyl v1 -syntax 4.0 -arg "-p thread_pool_stack=262144" -vcl+backend {
	sub vcl_recv {
		set req.esi = true;
	}
	sub vcl_backend_response {
		set beresp.do_esi = true;
	}
} -start

vinyl v1 -cliok "param.set debug +esi_chop"
vinyl v1 -cliok "param.set http_gzip_support true"
vinyl v1 -cliok "param.set gzip_memlevel 1"

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

client c1 {
	txreq  -hdr "Accept-Encoding: gzip"
	rxresp
	expect resp.http.content-encoding == gzip
	gunzip
	expect resp.status == 200
	expect resp.bodylen == 40
}

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