vtest "Regression test for #251: segfault on regsub on missing http header"

server s1 {
	rxreq
	txresp \
		-hdr "Foobar: _barf_" \
		-hdr "Connection: close" \
		-body "012345\n"
} -start

vinyl v1 -vcl+backend {
	sub vcl_backend_response {
		set beresp.http.Snafu1 =
		    "zoom" +
		    regsub(beresp.http.Foomble, "ar", "\0\0") +
		    "box";
	}
} -start

client c1 {
	txreq -url "/"
	rxresp
	expect resp.status == 200
	expect resp.http.X-Vinyl == "1001"
	expect resp.http.foobar == "_barf_"
	expect resp.http.snafu1 == "zoombox"
}

client c1 -run
