vtest "Test req.hash and bereq.hash"

server s1 {
	rxreq
	txresp
} -start

vinyl v1 -vcl+backend {
	import blob;

	sub vcl_backend_response {
		set beresp.http.bereq_hash = blob.encode(HEX, blob=bereq.hash);
	}
	sub vcl_deliver {
		set resp.http.req_hash = blob.encode(HEX, blob=req.hash);
		set resp.http.req_hash-sf = req.hash;
	}
} -start

client c1 {
	txreq -hdr "Host: localhost"
	rxresp
	expect resp.http.req_hash ~ "[[:xdigit:]]{64}"
	expect resp.http.req_hash == resp.http.bereq_hash
	expect resp.http.req_hash-sf == ":3k0f0yRKtKt7akzkyNsTGSDOJAZOQowTwKWhu5+kIu0=:"
} -run
