vtest "test basic gunzip for client"

server s1 {
	rxreq
	expect req.http.accept-encoding == "gzip"
	txresp -nolen -hdr "Content-Length: 49" -hdr "Content-Encoding: gzip"

	# "date > _ ; gzip -9 _" - contains filename + timestamp
	sendhex "1f 8b 08 08 ef 00 22 59  02 03 5f 00 0b 2e cd 53"
	sendhex "f0 4d ac 54 30 32 04 22  2b 03 13 2b 13 73 85 d0"
	sendhex "10 67 05 23 03 43 73 2e  00 cf 9b db c0 1d 00 00"
	sendhex "00"
} -start

vinyl v1 -cliok "param.set http_gzip_support true" -vcl+backend {
} -start

client c1 {
	txreq
	rxresp
	expect resp.bodylen == "29"
	expect resp.http.content-encoding == <undef>

	txreq -hdr "Accept-encoding: gzip;q=0.1"
	rxresp
	expect resp.http.content-encoding == "gzip"
	gunzip
	expect resp.bodylen == "29"
} -run

vinyl v1 -vsl_catchup

client c1 {
	txreq -proto HTTP/1.0
	rxresp
	expect resp.bodylen == "29"
	expect resp.http.content-encoding == <undef>
} -run

vinyl v1 -vsl_catchup

client c1 {
	txreq -req HEAD
	rxresp -no_obj
	expect resp.http.content-encoding == <undef>

	txreq -req HEAD -hdr "Accept-encoding: gzip;q=0.1"
	rxresp -no_obj
	expect resp.http.content-length == "49"
	expect resp.http.content-encoding == "gzip"
} -run

vinyl v1 -expect n_gzip == 0
vinyl v1 -expect n_gunzip == 3
vinyl v1 -expect n_test_gunzip == 1
