Commit 77fdf476 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

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/trunk/varnish-cache@5211 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 8f67839c
......@@ -308,6 +308,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
......@@ -388,6 +389,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
......@@ -395,6 +397,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));
}
......@@ -490,6 +494,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