vtest "ESI include out of workspace"

server s1 {
	rxreq
	expect req.http.esi0 == "foo"
	txresp -body {before <esi:include src="/body" sr="foo"/> after}
	rxreq
	expect req.url == "/body1"
	expect req.http.esi0 != "foo"
	txresp -body "include"
} -start

vinyl v1 -cliok "param.set feature +esi_disable_xml_check"
vinyl v1 -vcl+backend {
	import vtc;

	sub vcl_recv {
		if (req.esi_level > 0) {
			set req.url = req.url + req.esi_level;
		} else {
			set req.http.esi0 = "foo";
		}
	}
	sub vcl_backend_response {
		if (bereq.url == "/") {
			set beresp.do_esi = true;
		}
	}
	sub vcl_deliver {
		if (req.esi_level > 0) {
			vtc.workspace_alloc(client, -16);
		}
	}
} -start

logexpect l1 -v v1 -g raw {
	expect * * Error           "^Failure to push ESI processors"
} -start

client c1 {
	txreq -hdr "Host: foo"
	rxresp
	expect resp.status == 200
	expect resp.body == "before  after"
}  -run

logexpect l1 -wait
