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

phk at projects.linpro.no phk at projects.linpro.no
Sun Jun 18 12:10:45 CEST 2006


Author: phk
Date: 2006-06-18 12:10:45 +0200 (Sun, 18 Jun 2006)
New Revision: 202

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_http.c
   trunk/varnish-cache/bin/varnishd/cache_vcl.c
   trunk/varnish-cache/include/vcl_lang.h
   trunk/varnish-cache/lib/libvcl/vcl_compile.c
   trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c
Log:
Implement req.request properly



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2006-06-18 10:04:09 UTC (rev 201)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2006-06-18 10:10:45 UTC (rev 202)
@@ -83,6 +83,7 @@
 void http_Delete(struct http *hp);
 int http_GetHdr(struct http *hp, const char *hdr, char **ptr);
 int http_GetHdrField(struct http *hp, const char *hdr, const char *field, char **ptr);
+int http_GetReq(struct http *hp, char **b);
 int http_GetStatus(struct http *hp);
 int http_HdrIs(struct http *hp, const char *hdr, const char *val);
 int http_GetTail(struct http *hp, unsigned len, char **b, char **e);

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-06-18 10:04:09 UTC (rev 201)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-06-18 10:10:45 UTC (rev 202)
@@ -148,6 +148,15 @@
 }
 
 int
+http_GetReq(struct http *hp, char **b)
+{
+	if (hp->req == NULL)
+		return (0);
+	*b = hp->req;
+	return (1);
+}
+
+int
 http_GetURL(struct http *hp, char **b)
 {
 	if (hp->url == NULL)

Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vcl.c	2006-06-18 10:04:09 UTC (rev 201)
+++ trunk/varnish-cache/bin/varnishd/cache_vcl.c	2006-06-18 10:10:45 UTC (rev 202)
@@ -273,3 +273,14 @@
 		return (NULL);
 	return (p);
 }
+
+char *
+VCL_GetReq(VCL_FARGS)
+{
+	char *p;
+
+	assert(sess != NULL);
+	assert(sess->http != NULL);
+	assert(http_GetReq(sess->http, &p));
+	return (p);
+}

Modified: trunk/varnish-cache/include/vcl_lang.h
===================================================================
--- trunk/varnish-cache/include/vcl_lang.h	2006-06-18 10:04:09 UTC (rev 201)
+++ trunk/varnish-cache/include/vcl_lang.h	2006-06-18 10:10:45 UTC (rev 202)
@@ -101,6 +101,7 @@
 int VCL_switch_config(const char *);
 
 char *VCL_GetHdr(VCL_FARGS, const char *);
+char *VCL_GetReq(VCL_FARGS);
 
 typedef void vcl_init_f(void);
 typedef void vcl_func_f(VCL_FARGS);

Modified: trunk/varnish-cache/lib/libvcl/vcl_compile.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcl_compile.c	2006-06-18 10:04:09 UTC (rev 201)
+++ trunk/varnish-cache/lib/libvcl/vcl_compile.c	2006-06-18 10:10:45 UTC (rev 202)
@@ -122,7 +122,7 @@
 
 
 static struct var vars[] = {
-	{ "req.request",		STRING,	  0,  "\"GET\""	     },
+	{ "req.request",		STRING,	  0,  "VCL_GetReq(VCL_PASS_ARGS)"	     },
 	{ "obj.valid",			BOOL,	  0,  "sess->obj->valid"     },
 	{ "obj.cacheable",		BOOL,	  0,  "sess->obj->cacheable" },
 	{ "req.http.",			HEADER,	  0,  NULL },

Modified: trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c	2006-06-18 10:04:09 UTC (rev 201)
+++ trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c	2006-06-18 10:10:45 UTC (rev 202)
@@ -500,6 +500,7 @@
 	fputs("int VCL_switch_config(const char *);\n", f);
 	fputs("\n", f);
 	fputs("char *VCL_GetHdr(VCL_FARGS, const char *);\n", f);
+	fputs("char *VCL_GetReq(VCL_FARGS);\n", f);
 	fputs("\n", f);
 	fputs("typedef void vcl_init_f(void);\n", f);
 	fputs("typedef void vcl_func_f(VCL_FARGS);\n", f);




More information about the varnish-commit mailing list