]> err.no Git - varnish/commitdiff
Allow assignment to obj.status and resp.status
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 9 Jul 2007 20:35:20 +0000 (20:35 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 9 Jul 2007 20:35:20 +0000 (20:35 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1661 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_vrt.c

index 80433d709a4c2760f7af3223e2ae393748f06c5f..4edcbea8d5c57a28e2474a3e5cfd8c8d17c4db98 100644 (file)
@@ -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