Commit 1186896e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Do not suppress the Content-Length:, Age:, Range: and Proxy-Auth headers

from the backend on a pass operation.

Fixes: #730



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5074 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent d53eae77
......@@ -416,6 +416,7 @@ struct sess {
enum step step;
unsigned cur_method;
unsigned handling;
unsigned char pass;
unsigned char sendbody;
unsigned char wantbody;
int err_code;
......
......@@ -532,7 +532,7 @@ cnt_fetch(struct sess *sp)
AZ(sp->objcore);
}
l = http_EstimateWS(sp->wrk->beresp, HTTPH_A_INS, &nhttp);
l = http_EstimateWS(sp->wrk->beresp, sp->pass ? HTTPH_R_PASS : HTTPH_A_INS, &nhttp);
if (vary != NULL)
l += varyl;
......@@ -584,7 +584,7 @@ cnt_fetch(struct sess *sp)
hp2->logtag = HTTP_Obj;
http_CopyResp(hp2, hp);
http_FilterFields(sp->wrk, sp->fd, hp2, hp, HTTPH_A_INS);
http_FilterFields(sp->wrk, sp->fd, hp2, hp, sp->pass ? HTTPH_R_PASS : HTTPH_A_INS);
http_CopyHome(sp->wrk, sp->fd, hp2);
if (http_GetHdr(hp, H_Last_Modified, &b))
......@@ -954,6 +954,7 @@ cnt_pass(struct sess *sp)
sp->acct_tmp.pass++;
sp->sendbody = 1;
sp->step = STP_FETCH;
sp->pass = 1;
return (0);
}
......@@ -1041,6 +1042,7 @@ cnt_recv(struct sess *sp)
AN(sp->director);
sp->disable_esi = 0;
sp->pass = 0;
VCL_recv_method(sp);
recv_handling = sp->handling;
......
# $Id$
test "Check that HEAD returns Content-Length: if backend provides"
server s1 {
rxreq
txresp -bodylen 5
rxreq
txresp -bodylen 6
} -start
varnish v1 -vcl+backend {
} -start
client c1 {
txreq -req HEAD
rxresp -no_obj
expect resp.http.content-length == 5
} -run
varnish v1 -vcl+backend {
sub vcl_recv {
return (pass);
}
}
client c1 {
txreq -req HEAD
rxresp -no_obj
expect resp.http.content-length == 6
} -run
......@@ -198,7 +198,8 @@ varnish_delete(struct varnish *v)
vtc_logclose(v->vl);
free(v->name);
free(v->workdir);
VSM_Delete(v->vd);
if (v->vd != NULL)
VSM_Delete(v->vd);
/*
* We do not delete the workdir, it may contain stuff people
......
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