r1560 - in trunk/varnish-cache: bin/varnishd include lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Mon Jun 25 12:37:12 CEST 2007


Author: phk
Date: 2007-06-25 12:37:11 +0200 (Mon, 25 Jun 2007)
New Revision: 1560

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/include/vrt_obj.h
   trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
   trunk/varnish-cache/lib/libvcl/vcc_obj.c
Log:
Implement resp.proto resp.status and resp.response.

Visible from vcl_fetch() only.



Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2007-06-25 10:22:44 UTC (rev 1559)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2007-06-25 10:37:11 UTC (rev 1560)
@@ -253,6 +253,32 @@
 
 /*--------------------------------------------------------------------*/
 
+const char *
+VRT_r_resp_proto(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(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(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(struct sess *sp)
 {

Modified: trunk/varnish-cache/include/vrt_obj.h
===================================================================
--- trunk/varnish-cache/include/vrt_obj.h	2007-06-25 10:22:44 UTC (rev 1559)
+++ trunk/varnish-cache/include/vrt_obj.h	2007-06-25 10:37:11 UTC (rev 1560)
@@ -36,5 +36,11 @@
 void VRT_l_obj_cacheable(struct sess *, unsigned);
 double VRT_r_obj_ttl(struct sess *);
 void VRT_l_obj_ttl(struct sess *, double);
+const char * VRT_r_resp_proto(struct sess *);
+void VRT_l_resp_proto(struct sess *, const char *);
+int VRT_r_resp_status(struct sess *);
+void VRT_l_resp_status(struct sess *, int);
+const char * VRT_r_resp_response(struct sess *);
+void VRT_l_resp_response(struct sess *, const char *);
 const char * VRT_r_resp_http_(struct sess *);
 void VRT_l_resp_http_(struct sess *, const char *);

Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl	2007-06-25 10:22:44 UTC (rev 1559)
+++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl	2007-06-25 10:37:11 UTC (rev 1560)
@@ -52,6 +52,9 @@
   { obj.valid		BOOL	{                         hit fetch discard timeout} }
   { obj.cacheable	BOOL	{                         hit fetch discard timeout} }
   { obj.ttl		TIME	{                         hit fetch discard timeout} }
+  { resp.proto		STRING	{                             fetch                } }
+  { resp.status		INT	{                             fetch                } }
+  { resp.response	STRING	{                             fetch                } }
   { resp.http.		HEADER	{                             fetch                } }
 }
 
@@ -60,6 +63,7 @@
 set tt(BOOL)	"unsigned"
 set tt(BACKEND)	"struct backend *"
 set tt(TIME)	"double"
+set tt(INT)	"int"
 set tt(HEADER)	"const char *"
 set tt(HOSTNAME) "const char *"
 set tt(PORTNAME) "const char *"

Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_obj.c	2007-06-25 10:22:44 UTC (rev 1559)
+++ trunk/varnish-cache/lib/libvcl/vcc_obj.c	2007-06-25 10:37:11 UTC (rev 1560)
@@ -89,6 +89,21 @@
 	    "VRT_l_obj_ttl(sp, ",
 	    VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT
 	},
+	{ "resp.proto", STRING, 10,
+	    "VRT_r_resp_proto(sp)",
+	    "VRT_l_resp_proto(sp, ",
+	    VCL_MET_FETCH
+	},
+	{ "resp.status", INT, 11,
+	    "VRT_r_resp_status(sp)",
+	    "VRT_l_resp_status(sp, ",
+	    VCL_MET_FETCH
+	},
+	{ "resp.response", STRING, 13,
+	    "VRT_r_resp_response(sp)",
+	    "VRT_l_resp_response(sp, ",
+	    VCL_MET_FETCH
+	},
 	{ "resp.http.", HEADER, 10,
 	    "VRT_r_resp_http_(sp)",
 	    "VRT_l_resp_http_(sp, ",




More information about the varnish-commit mailing list