varnishtest "Check that between_bytes_timeout behaves from parameters"

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

varnish v1 -vcl+backend {
	sub vcl_backend_response {
		set beresp.do_stream = false;
	}
} -start
varnish v1 -cliok "param.set between_bytes_timeout 1"

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

delay 1

varnish v1 -expect n_object == 0
varnish v1 -expect n_objectcore == 0

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

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

varnish v1 -expect n_object == 1
varnish v1 -expect n_objectcore == 1
varnish v1 -expect fetch_failed == 1
