varnishtest "#2219: PROXY tight workspace handling"

server s1 {
	rxreq
	txresp
	rxreq
	txresp
	rxreq
	txresp
} -start

varnish v1 -arg "-p workspace_client=9k" \
	   -arg "-p vsl_buffer=4k" \
	   -proto PROXY \
	   -vcl+backend {
	import std;
	import vtc;
	sub vcl_recv {
		std.log(vtc.workspace_free(client));
		return (pass);
	}
} -start

client c1 {
	send "PROXY TCP4 127.0.0.1 127.0.0.1 1111 2222\r\nGET /${string,repeat,736,A} HTTP/1.1\r\n\r\n"
	rxresp
} -run

client c2 {
	# UNSPEC proto
	sendhex {
0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a
21 00 00 00
47 45 54 20 2f
${string,repeat,732,"42 "}
20 48 54 54 50 2f 31 2e 31 0d 0a 0d 0a
}
	rxresp
} -run

client c3 {
	send "PROXY TCP4 127.0.0.1 127.0.0.1 1111 2222\r\nGET /${string,repeat,740,C} HTTP/1.1\r\n\r\n"
	rxresp
} -run
