vtest "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

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

	sub vcl_pipe {
		if (req.url == "/2") {
			set bereq.http.connection = req.http.connection;
		}
		set bereq.http.xid = bereq.xid;
	}
} -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

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