vtest "Does anything get through at all ?"

feature ipv4
feature ipv6

server s1 -listen 127.0.0.1:0 {
	rxreq
	txresp -body "012345\n"
} -start

server s2 -listen [::1]:0 {
	rxreq
	txresp -body "012345\n"
} -start

vinyl v1 -vcl+backend {
	sub vcl_recv {
		if (req.url == "/1") {
			set req.backend_hint = s1;
		} else {
			set req.backend_hint = s2;
		}
	}
	sub vcl_backend_response {
		set beresp.do_stream = false;
	}
	sub vcl_deliver {
		# make s_resp_hdrbytes deterministic
		unset resp.http.via;
	}
} -start

vinyl v1 -cliok "param.set debug +workspace"
vinyl v1 -cliok "param.set debug +witness"

#vinyl v1 -vsc *

vinyl v1 -expect MAIN.n_object == 0
vinyl v1 -expect MAIN.sess_conn == 0
vinyl v1 -expect MAIN.client_req == 0
vinyl v1 -expect MAIN.cache_miss == 0

client c1 {
	txreq -url "/1"
	rxresp
	expect resp.status == 200
} -run

vinyl v1 -expect n_object == 1
vinyl v1 -expect sess_conn == 1
vinyl v1 -expect client_req == 1
vinyl v1 -expect cache_miss == 1
vinyl v1 -expect s_sess == 1
vinyl v1 -expect s_resp_bodybytes == 7
vinyl v1 -expect s_resp_hdrbytes == 156
client c1 {
	txreq -url "/2"
	rxresp
	expect resp.status == 200
} -run

# vinyl v1 -vsc *
vinyl v1 -expect n_object == 2
vinyl v1 -expect sess_conn == 2
vinyl v1 -expect client_req == 2
vinyl v1 -expect cache_miss == 2
vinyl v1 -expect s_sess == 2
vinyl v1 -expect s_resp_bodybytes == 14
vinyl v1 -expect s_resp_hdrbytes == 312
