vtest "Check the between_bytes_timeout behaves from vcl"

server s1 {
	rxreq
	send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n"
	delay 4.0
	send "Baba\n"
} -start

vinyl v1 -vcl+backend {
	sub vcl_backend_fetch {
		set bereq.between_bytes_timeout = 2s;
	}
	sub vcl_backend_response {
		set beresp.do_stream = false;
	}
} -start

client c1 {
	txreq
	rxresp
	expect resp.status == 503
} -run

server s1 {
	rxreq
	send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n"
	delay 1.0
	send "Baba\n"
	delay 1.0
	send "Baba\n"
	delay 1.0
	send "Baba\n"
	delay 1.0
	send "Baba\n"
	delay 1.0
	send "Baba\n"
} -start

client c1 {
	txreq
	timeout 10
	rxresp
	expect resp.status == 200
	expect resp.bodylen == 25
} -run
