r2848 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Jun 27 13:18:00 CEST 2008


Author: phk
Date: 2008-06-27 13:18:00 +0200 (Fri, 27 Jun 2008)
New Revision: 2848

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
Log:
Get "line1" request/reponse fields under control.



Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2008-06-27 11:16:58 UTC (rev 2847)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2008-06-27 11:18:00 UTC (rev 2848)
@@ -210,6 +210,14 @@
 	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(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 @@
 	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 @@
 
 /*--------------------------------------------------------------------*/
 
-#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 @@
 
 /*--------------------------------------------------------------------*/
 
-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)
 {




More information about the varnish-commit mailing list