From: phk Date: Mon, 9 Jul 2007 20:35:20 +0000 (+0000) Subject: Allow assignment to obj.status and resp.status X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a54aec5d27d4c2f2eaa4bed3f1796145ed1d62d7;p=varnish Allow assignment to obj.status and resp.status git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1661 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index 80433d70..4edcbea8 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -205,13 +205,37 @@ VRT_DO_HDR(bereq, url, sp->bereq->http, HTTP_HDR_URL) VRT_DO_HDR(bereq, proto, sp->bereq->http, HTTP_HDR_PROTO) VRT_DO_HDR(obj, proto, &sp->obj->http, HTTP_HDR_PROTO) VRT_DO_HDR(obj, response, &sp->obj->http, HTTP_HDR_RESPONSE) -VRT_DO_HDR(resp, proto, sp->bereq->http, HTTP_HDR_PROTO) -VRT_DO_HDR(resp, response, sp->bereq->http, HTTP_HDR_RESPONSE) +VRT_DO_HDR(resp, proto, sp->http, HTTP_HDR_PROTO) +VRT_DO_HDR(resp, response, sp->http, HTTP_HDR_RESPONSE) + +void +VRT_l_obj_status(struct sess *sp, int num) +{ + char *p; + + assert(num >= 100 && num <= 999); + p = WS_Alloc(sp->obj->http.ws, 4); + if (p == NULL) + WSL(sp->wrk, SLT_LostHeader, sp->fd, "obj.status"); + else + sprintf(p, "%d", num); + http_SetH(&sp->obj->http, HTTP_HDR_STATUS, p); +} + +void +VRT_l_resp_status(struct sess *sp, int num) +{ + char *p; + + assert(num >= 100 && num <= 999); + p = WS_Alloc(sp->http->ws, 4); + if (p == NULL) + WSL(sp->wrk, SLT_LostHeader, sp->fd, "resp.status"); + else + sprintf(p, "%d", num); + http_SetH(sp->http, HTTP_HDR_STATUS, p); +} -#if 0 -VRT_DO_HDR(obj, status, &sp->obj->http, HTTP_HDR_STATUS) -VRT_DO_HDR(resp, status, sp->bereq->http, HTTP_HDR_STATUS) -#endif /*--------------------------------------------------------------------*/ void