Commit 9ec14234 authored by Gil Pedersen's avatar Gil Pedersen Committed by Poul-Henning Kamp

Don't error on short range response

parent 7da66c9b
......@@ -55,7 +55,8 @@ vrg_range_fini(struct vdp_ctx *vdc, void **priv)
CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
CAST_OBJ_NOTNULL(vrg_priv, *priv, VRG_PRIV_MAGIC);
if (vrg_priv->range_off < vrg_priv->range_high) {
if (vrg_priv->req->resp_len >= 0 &&
vrg_priv->range_off < vrg_priv->range_high) {
Req_Fail(vrg_priv->req, SC_RANGE_SHORT);
vrg_priv->req->vdc->retval = -1;
}
......
......@@ -2,7 +2,7 @@ varnishtest "range requests on streamed response"
barrier b1 cond 2 -cyclic
server s1 -repeat 4 {
server s1 -repeat 5 {
rxreq
txresp -nolen \
-hdr "Transfer-Encoding: chunked" \
......@@ -24,11 +24,6 @@ varnish v1 -vcl+backend {} -start
varnish v1 -cliok "param.set debug +syncvsl"
logexpect l1 -v v1 -g session {
expect 0 1000 Begin sess
expect * = SessClose RANGE_SHORT
} -start
client c1 {
txreq -url /1 -hdr "Range: bytes=17-101"
rxresphdrs
......@@ -65,7 +60,15 @@ client c1 {
barrier b1 sync
rxrespbody
expect resp.bodylen == 34
delay .1
# Keeps working after short response
txreq -url /5 -hdr "Range: bytes=17-101"
rxresphdrs
expect resp.status == 206
barrier b1 sync
rxrespbody
expect resp.bodylen == 85
} -run
varnish v1 -expect sc_range_short == 1
logexpect l1 -wait
varnish v1 -expect sc_range_short == 0
......@@ -14,6 +14,11 @@ server s1 {
varnish v1 -vcl+backend { } -start
logexpect l1 -v v1 -g session {
expect 0 1000 Begin sess
expect * = SessClose RANGE_SHORT
} -start
client c1 {
txreq -hdr "range: bytes=0-16"
rxresp -no_obj
......@@ -24,6 +29,7 @@ client c1 {
} -run
varnish v1 -expect MAIN.sc_range_short == 1
logexpect l1 -wait
delay .3
......@@ -43,3 +49,5 @@ client c2 {
expect rst.err == INTERNAL_ERROR
} -run
} -run
varnish v1 -expect MAIN.sc_range_short == 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment