varnishtest "basic default HTTP transactions with expect and options"

server s1 {
	rxreq
	expect req.method == PUT
	expect req.proto == HTTP/1.0
	expect req.url == "/foo"
	txresp -proto HTTP/1.2 -status 201 -reason Foo
}

server s1 -start

client c1 -connect ${s1_sock} {
	txreq -method PUT -proto HTTP/1.0 -url /foo
	rxresp
	expect resp.proto == HTTP/1.2
	expect resp.status == 201
	expect resp.reason == Foo
	expect resp.status -lt 202
	expect resp.status -le 201
	expect resp.status -eq 201
	expect resp.status -ge 201
	expect resp.status -gt 0xc8
}

client c1 -run

server s1 -wait

# The same tests with unix domain sockets
server s2 -listen "${tmpdir}/s2.sock" {
	rxreq
	expect req.method == PUT
	expect req.proto == HTTP/1.0
	expect req.url == "/foo"
	txresp -proto HTTP/1.2 -status 201 -reason Foo
} -start

client c2 -connect ${s2_sock} {
	txreq -req PUT -proto HTTP/1.0 -url /foo
	rxresp
	expect resp.proto == HTTP/1.2
	expect resp.status == 201
	expect resp.reason == Foo
}

client c2 -run

server s2 -wait
