vtest "Test https_scheme parameter"

server s1 {
	rxreq
	expect req.url == /bar
	txresp

	rxreq
	expect req.url == https://www.example.com/bar
	txresp
} -start

vinyl v1 -vcl+backend {

	sub vcl_deliver {
		set resp.http.rxhost = req.http.host;
		set resp.http.rxurl = req.url;
	}
} -start

client c1 {
	txreq -url http://www.example.com/bar
	rxresp
	expect resp.http.rxhost == www.example.com
	expect resp.http.rxurl == /bar

	txreq -url https://www.example.com/bar
	rxresp
	expect resp.http.rxhost == www.example.com
	expect resp.http.rxurl == /bar
} -run

vinyl v1 -cliok "param.set feature -https_scheme"

client c1 {
	txreq -url http://www.example.com/bar
	rxresp
	expect resp.http.rxhost == www.example.com
	expect resp.http.rxurl == /bar

	txreq -url https://www.example.com/bar
	rxresp
	expect resp.status == 400
} -run
