Commit b661f7e9 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

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
parent 653a9ea1
......@@ -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);
/*
......
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
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