varnishtest "Error on multiple Host headers"

varnish v1 -vcl {backend be none;} -start
varnish v1 -cliok "param.set debug +syncvsl"

client c1 {
	txreq -hdr "Host: foo" -hdr "Host: bar"
	rxresp
	expect resp.status == 400
} -run

varnish v1 -vsl_catchup
varnish v1 -expect client_req_400 == 1

client c1 {
	txreq -method POST -hdr "Content-Length: 12" -hdr "Content-Length: 12" -bodylen 12
	rxresp
	expect resp.status == 400
} -run

varnish v1 -vsl_catchup
varnish v1 -expect client_req_400 == 2

varnish v1 -cliok "param.set feature +http2"

client c2 {
	stream 7 {
		txreq -hdr host foo -hdr host bar
		rxresp
		expect resp.status == 400
	} -run
} -run

varnish v1 -vsl_catchup
varnish v1 -expect client_req_400 == 3

# H2 with multiple content-length runs into thread-scheduling differences,
# and is unnecessary, as we know the check works from H1 and that it
# will be hit, because H2 with multiple Host: triggered.
