varnishtest "Test host header specification"

server s1 {
	rxreq
	expect req.url == "/foo"
	expect req.http.host == "snafu"
	txresp -body "foo1"

	rxreq
	expect req.url == "/bar"
	expect req.http.host == "${localhost}"
	txresp -body "foo1"
} -start

varnish v1 -vcl+backend { } -start

client c1 {
	txreq -url "/foo" -hdr "Host: snafu"
	rxresp
	txreq -url "/bar" -proto HTTP/1.0
	rxresp
} -run

server s2 {
	rxreq
	expect req.url == "/barf"
	expect req.http.host == "FOObar"
	txresp -body "foo1"
} -start

varnish v1 -vcl {
	backend b1 {
		.host = "${s2_addr}";
		.port = "${s2_port}";
		.host_header = "FOObar";
	}
}

client c1 {
	txreq -url "/barf" -proto HTTP/1.0
	rxresp
} -run
