[4.0] b661f7e Don't attempt range delivery on a synth response
Martin Blix Grydeland
martin at varnish-software.com
Tue Jan 20 14:38:44 CET 2015
commit b661f7e9f2a4aab29d0f16f11a0aa27513afb63c
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Tue Jan 20 14:14:52 2015 +0100
Don't attempt range delivery on a synth response
This could happen on a 200 synth object if the client request had a
Range header. The range code path would fail because it requires an
obj which the synth path doesn't have.
Fixes: #1660
diff --git a/bin/varnishd/cache/cache_http1_deliver.c b/bin/varnishd/cache/cache_http1_deliver.c
index dcb290f..e0a9618 100644
--- a/bin/varnishd/cache/cache_http1_deliver.c
+++ b/bin/varnishd/cache/cache_http1_deliver.c
@@ -358,7 +358,6 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
void
V1D_Deliver_Synth(struct req *req)
{
- char *r;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
AZ(req->obj);
@@ -395,16 +394,6 @@ V1D_Deliver_Synth(struct req *req)
req->vdps[0] = v1d_bytes;
req->vdp_nxt = 0;
- if (
- req->wantbody &&
- !(req->res_mode & RES_ESI_CHILD) &&
- cache_param->http_range_support &&
- http_GetStatus(req->resp) == 200) {
- http_SetHeader(req->resp, "Accept-Ranges: bytes");
- if (http_GetHdr(req->http, H_Range, &r))
- v1d_dorange(req, NULL, r);
- }
-
WRW_Reserve(req->wrk, &req->sp->fd, req->vsl, req->t_prev);
/*
diff --git a/bin/varnishtest/tests/r01660.vtc b/bin/varnishtest/tests/r01660.vtc
new file mode 100644
index 0000000..1ce133c
--- /dev/null
+++ b/bin/varnishtest/tests/r01660.vtc
@@ -0,0 +1,18 @@
+varnishtest "#1660: range and synth"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_recv {
+ return (synth(200, "OK"));
+ }
+} -start
+
+client c1 {
+ txreq -hdr "Range: 0-1"
+ rxresp
+ expect resp.status == 200
+} -run
More information about the varnish-commit
mailing list