vtest "bidirectional message bodies"

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 \
		-body "987654321\n"
}

server s1 -start

client c1 -connect ${s1_sock} {
	txreq -req PUT -proto HTTP/1.0 -url /foo \
		-body "123456789\n"
	rxresp
	expect resp.proto == HTTP/1.2
	expect resp.status == 201
	expect resp.reason == Foo
}

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 \
		-body "987654321\n"
}

server s2 -start

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

client c2 -run

server s2 -wait
