From 303a969befca451a33e280f65699b5564486bf87 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 27 Jun 2008 11:18:00 +0000 Subject: [PATCH] Get "line1" request/reponse fields under control. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2848 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_vrt.c | 61 +++++++++----------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index 9c2bb230..d17fef09 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -210,6 +210,14 @@ VRT_l_##obj##_##hdr(const struct sess *sp, const char *p, ...) \ vrt_do_string(sp->wrk, sp->fd, \ http, fld, #obj "." #hdr, p, ap); \ va_end(ap); \ +} \ + \ +const char * \ +VRT_r_##obj##_##hdr(const struct sess *sp) \ +{ \ + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); \ + CHECK_OBJ_NOTNULL(http, HTTP_MAGIC); \ + return (http->hd[fld].b); \ } VRT_DO_HDR(req, request, sp->http, HTTP_HDR_REQ) @@ -223,6 +231,10 @@ VRT_DO_HDR(obj, response, sp->obj->http, HTTP_HDR_RESPONSE) VRT_DO_HDR(resp, proto, sp->http, HTTP_HDR_PROTO) VRT_DO_HDR(resp, response, sp->http, HTTP_HDR_RESPONSE) +/*--------------------------------------------------------------------*/ + +/* XXX: review this */ + void VRT_l_obj_status(const struct sess *sp, int num) { @@ -262,6 +274,14 @@ VRT_l_resp_status(const struct sess *sp, int num) http_SetH(sp->http, HTTP_HDR_STATUS, p); } +int +VRT_r_resp_status(const struct sess *sp) +{ + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); + return (atoi(sp->obj->http->hd[HTTP_HDR_STATUS].b)); +} + /*--------------------------------------------------------------------*/ void @@ -408,21 +428,6 @@ VRT_r_req_backend(struct sess *sp) /*--------------------------------------------------------------------*/ -#define VREQ(n1, n2) \ -const char * \ -VRT_r_req_##n1(const struct sess *sp) \ -{ \ - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); \ - CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC); \ - return (sp->http->hd[n2].b); \ -} - -VREQ(request, HTTP_HDR_REQ) -VREQ(url, HTTP_HDR_URL) -VREQ(proto, HTTP_HDR_PROTO) - -/*--------------------------------------------------------------------*/ - int VRT_r_req_restarts(const struct sess *sp) { @@ -456,32 +461,6 @@ VRT_r_req_grace(struct sess *sp) /*--------------------------------------------------------------------*/ -const char * -VRT_r_resp_proto(const struct sess *sp) -{ - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); - return (sp->obj->http->hd[HTTP_HDR_PROTO].b); -} - -const char * -VRT_r_resp_response(const struct sess *sp) -{ - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); - return (sp->obj->http->hd[HTTP_HDR_RESPONSE].b); -} - -int -VRT_r_resp_status(const struct sess *sp) -{ - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); - return (atoi(sp->obj->http->hd[HTTP_HDR_STATUS].b)); -} - -/*--------------------------------------------------------------------*/ - struct sockaddr * VRT_r_client_ip(const struct sess *sp) { -- 2.39.5