varnishtest "Check that a pipe transaction works"

server s1 -repeat 1 {
	rxreq
	expect req.proto == "HTTP/1.0"
	expect req.http.connection == "close"
	txresp
	rxreq
	expect req.proto == "nonsense"
	expect req.http.connection == "keep-alive"
	txresp
} -start

varnish v1 -vcl+backend {
	sub vcl_recv {
		return(pipe);
	}

	sub vcl_pipe {
		if (req.url == "/2") {
			set bereq.http.connection = req.http.connection;
		}
	}
} -start

client c1 {
	txreq -proto HTTP/1.0 -url /1 -hdr "Connection: keep-alive"
	rxresp
	expect resp.status == 200
	txreq -proto nonsense -url /2 -hdr "Connection: keep-alive"
	rxresp
	expect resp.status == 200
} -run

varnish v1 -expect n_object == 0
varnish v1 -expect sess_conn == 1
varnish v1 -expect client_req == 1
varnish v1 -expect s_sess == 1
varnish v1 -expect s_pipe == 1
