Commit f691cad7 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Merge r5211: Set the int status when setting the txt header status in...

Merge r5211: Set the int status when setting the txt header status in VRT_l_[obj|resp|beresp]_status.

Fixes: #769



git-svn-id: http://www.varnish-cache.org/svn/branches/2.1@5361 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent a609c575
......@@ -280,6 +280,7 @@ VRT_l_obj_status(const struct sess *sp, int num)
else
sprintf(p, "%d", num);
http_SetH(sp->obj->http, HTTP_HDR_STATUS, p);
sp->obj->http->status = num;
}
/* Add an objecthead to the saintmode list for the (hopefully) relevant
......@@ -360,6 +361,7 @@ VRT_l_resp_status(const struct sess *sp, int num)
else
sprintf(p, "%d", num);
http_SetH(sp->wrk->resp, HTTP_HDR_STATUS, p);
sp->wrk->resp->status = num;
}
int
......@@ -367,6 +369,8 @@ VRT_r_resp_status(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->wrk->resp, HTTP_MAGIC);
if (sp->wrk->resp->status)
return (sp->wrk->resp->status);
return (atoi(sp->wrk->resp->hd[HTTP_HDR_STATUS].b));
}
......@@ -462,6 +466,7 @@ VRT_l_beresp_status(const struct sess *sp, int num)
else
sprintf(p, "%d", num);
http_SetH(sp->wrk->beresp, HTTP_HDR_STATUS, p);
sp->wrk->beresp->status = num;
}
int
......
# $Id$
test "Test that set status code is readable again for obj.status and beresp.status"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.url ~ "^/test1") {
error 700;
}
}
sub vcl_fetch {
set beresp.status = 404;
set beresp.http.X-status = beresp.status;
return (deliver);
}
sub vcl_error {
if (obj.status == 700) {
set obj.status=404;
set obj.http.X-status = obj.status;
return (deliver);
}
}
} -start
client c1 {
txreq -url "/test1"
rxresp
expect resp.status == 404
expect resp.http.X-status == 404
}
client c2 {
txreq -url "/test2"
rxresp
expect resp.status == 404
expect resp.http.X-status == 404
}
client c1 -run
client c2 -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