[master] 0e9627d Adopt Lasses proposal to rename [be]req.request [be]req.method.

Poul-Henning Kamp phk at varnish-cache.org
Mon Jan 7 13:59:26 CET 2013


commit 0e9627ddb36292efa3ece4ec977b9d68c9d85cec
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 7 12:58:22 2013 +0000

    Adopt Lasses proposal to rename [be]req.request [be]req.method.
    
    Keep .request as an alias for at least one release cycle.
    
    I have gone a level deeper than Lasses patch, and also carried this
    rename through the C-code, docs and VTC files.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index f97f8a7..d4ddfa8 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -181,7 +181,7 @@ struct ws {
  */
 
 enum httpwhence {
-	HTTP_Req	= 1,
+	HTTP_Method	= 1,
 	HTTP_Resp,
 	HTTP_Bereq,
 	HTTP_Beresp,
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index be87d2b..8586090 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -68,7 +68,7 @@ ved_include(struct req *preq, const char *src, const char *host)
 
 	req->http0->conds = 0;
 
-	HTTP_Setup(req->http, req->ws, req->vsl, HTTP_Req);
+	HTTP_Setup(req->http, req->ws, req->vsl, HTTP_Method);
 
 	http_SetH(req->http0, HTTP_HDR_URL, src);
 	if (host != NULL && *host != '\0')  {
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 73fb7fc..91ab200 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -42,11 +42,11 @@
 #undef HTTPH
 
 static const enum VSL_tag_e foo[] = {
-	[HTTP_Req]	= SLT_ReqRequest,
-	[HTTP_Resp]	= SLT_RespRequest,
-	[HTTP_Bereq]	= SLT_BereqRequest,
-	[HTTP_Beresp]	= SLT_BerespRequest,
-	[HTTP_Obj]	= SLT_ObjRequest,
+	[HTTP_Method]	= SLT_ReqMethod,
+	[HTTP_Resp]	= SLT_RespMethod,
+	[HTTP_Bereq]	= SLT_BereqMethod,
+	[HTTP_Beresp]	= SLT_BerespMethod,
+	[HTTP_Obj]	= SLT_ObjMethod,
 };
 
 static enum VSL_tag_e
@@ -56,8 +56,8 @@ http2shmlog(const struct http *hp, int t)
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 	if (t > HTTP_HDR_FIRST)
 		t = HTTP_HDR_FIRST;
-	assert(hp->logtag >= HTTP_Req && hp->logtag <= HTTP_Obj); /*lint !e685*/
-	assert(t >= HTTP_HDR_REQ && t <= HTTP_HDR_FIRST);
+	assert(hp->logtag >= HTTP_Method && hp->logtag <= HTTP_Obj); /*lint !e685*/
+	assert(t >= HTTP_HDR_METHOD && t <= HTTP_HDR_FIRST);
 	return ((enum VSL_tag_e)(foo[hp->logtag] + t));
 }
 
@@ -473,8 +473,8 @@ const char *
 http_GetReq(const struct http *hp)
 {
 
-	Tcheck(hp->hd[HTTP_HDR_REQ]);
-	return (hp->hd[HTTP_HDR_REQ].b);
+	Tcheck(hp->hd[HTTP_HDR_METHOD]);
+	return (hp->hd[HTTP_HDR_METHOD].b);
 }
 
 /*--------------------------------------------------------------------
@@ -664,7 +664,7 @@ http_DissectRequest(struct req *req)
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 
 	retval = http_splitline(hp, htc,
-	    HTTP_HDR_REQ, HTTP_HDR_URL, HTTP_HDR_PROTO);
+	    HTTP_HDR_METHOD, HTTP_HDR_URL, HTTP_HDR_PROTO);
 	if (retval != 0) {
 		VSLbt(req->vsl, SLT_HttpGarbage, htc->rxbuf);
 		return (retval);
@@ -757,7 +757,7 @@ void
 http_ForceGet(const struct http *to)
 {
 	if (strcmp(http_GetReq(to), "GET"))
-		http_SetH(to, HTTP_HDR_REQ, "GET");
+		http_SetH(to, HTTP_HDR_METHOD, "GET");
 }
 
 void
@@ -845,7 +845,7 @@ http_FilterReq(const struct req *req, unsigned how)
 	hp = req->busyobj->bereq;
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 
-	http_linkh(hp, req->http, HTTP_HDR_REQ);
+	http_linkh(hp, req->http, HTTP_HDR_METHOD);
 	http_linkh(hp, req->http, HTTP_HDR_URL);
 	if (how == HTTPH_R_FETCH)
 		http_SetH(hp, HTTP_HDR_PROTO, "HTTP/1.1");
@@ -1068,8 +1068,8 @@ http_Write(const struct worker *w, const struct http *hp, int resp)
 		http_VSLH(hp, HTTP_HDR_RESPONSE);
 	} else {
 		AN(hp->hd[HTTP_HDR_URL].b);
-		l = WRW_WriteH(w, &hp->hd[HTTP_HDR_REQ], " ");
-		http_VSLH(hp, HTTP_HDR_REQ);
+		l = WRW_WriteH(w, &hp->hd[HTTP_HDR_METHOD], " ");
+		http_VSLH(hp, HTTP_HDR_METHOD);
 		l += WRW_WriteH(w, &hp->hd[HTTP_HDR_URL], " ");
 		http_VSLH(hp, HTTP_HDR_URL);
 		l += WRW_WriteH(w, &hp->hd[HTTP_HDR_PROTO], "\r\n");
diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c
index ab870ad..e6b12ee 100644
--- a/bin/varnishd/cache/cache_http1_fsm.c
+++ b/bin/varnishd/cache/cache_http1_fsm.c
@@ -257,7 +257,7 @@ http1_dissect(struct worker *wrk, struct req *req)
 	req->vcl = wrk->vcl;
 	wrk->vcl = NULL;
 
-	HTTP_Setup(req->http, req->ws, req->vsl, HTTP_Req);
+	HTTP_Setup(req->http, req->ws, req->vsl, HTTP_Method);
 	req->err_code = http_DissectRequest(req);
 
 	/* If we could not even parse the request, just close */
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index e50a9a5..547755a 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -1132,7 +1132,7 @@ cnt_recv(const struct worker *wrk, struct req *req)
 	SHA256_Final(req->digest, req->sha256ctx);
 	req->sha256ctx = NULL;
 
-	if (!strcmp(req->http->hd[HTTP_HDR_REQ].b, "HEAD"))
+	if (!strcmp(req->http->hd[HTTP_HDR_METHOD].b, "HEAD"))
 		req->wantbody = 0;
 	else
 		req->wantbody = 1;
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 76c17d6..f724054 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -81,10 +81,12 @@ VRT_r_##obj##_##hdr(const struct req *req)			\
 	return (http->hd[fld].b);				\
 }
 
-VRT_DO_HDR(req,   request,	req->http,		HTTP_HDR_REQ)
+VRT_DO_HDR(req,   method,	req->http,		HTTP_HDR_METHOD)
+VRT_DO_HDR(req,   request,	req->http,		HTTP_HDR_METHOD)
 VRT_DO_HDR(req,   url,		req->http,		HTTP_HDR_URL)
 VRT_DO_HDR(req,   proto,	req->http,		HTTP_HDR_PROTO)
-VRT_DO_HDR(bereq, request,	req->busyobj->bereq,	HTTP_HDR_REQ)
+VRT_DO_HDR(bereq, method,	req->busyobj->bereq,	HTTP_HDR_METHOD)
+VRT_DO_HDR(bereq, request,	req->busyobj->bereq,	HTTP_HDR_METHOD)
 VRT_DO_HDR(bereq, url,		req->busyobj->bereq,	HTTP_HDR_URL)
 VRT_DO_HDR(bereq, proto,	req->busyobj->bereq,	HTTP_HDR_PROTO)
 VRT_DO_HDR(obj,   proto,	req->obj->http,		HTTP_HDR_PROTO)
diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl
index d0d4c2e..bb78074 100644
--- a/bin/varnishd/default.vcl
+++ b/bin/varnishd/default.vcl
@@ -48,17 +48,17 @@ sub vcl_recv {
 	    set req.http.X-Forwarded-For = client.ip;
 	}
     }
-    if (req.request != "GET" &&
-      req.request != "HEAD" &&
-      req.request != "PUT" &&
-      req.request != "POST" &&
-      req.request != "TRACE" &&
-      req.request != "OPTIONS" &&
-      req.request != "DELETE") {
+    if (req.method != "GET" &&
+      req.method != "HEAD" &&
+      req.method != "PUT" &&
+      req.method != "POST" &&
+      req.method != "TRACE" &&
+      req.method != "OPTIONS" &&
+      req.method != "DELETE") {
         /* Non-RFC2616 or CONNECT which is weird. */
         return (pipe);
     }
-    if (req.request != "GET" && req.request != "HEAD") {
+    if (req.method != "GET" && req.method != "HEAD") {
         /* We only deal with GET and HEAD by default */
         return (pass);
     }
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 0dbebfe..f885985 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -301,7 +301,7 @@ collect_backend(struct logline *lp, enum VSL_tag_e tag, unsigned spec,
 			trimfield(&lp->df_h, ptr, end);
 		break;
 
-	case SLT_BereqRequest:
+	case SLT_BereqMethod:
 		if (!lp->active)
 			break;
 		if (lp->df_m != NULL) {
@@ -420,7 +420,7 @@ collect_client(struct logline *lp, enum VSL_tag_e tag, unsigned spec,
 		trimfield(&lp->df_h, ptr, end);
 		break;
 
-	case SLT_ReqRequest:
+	case SLT_ReqMethod:
 		if (!lp->active)
 			break;
 		if (lp->df_m != NULL) {
diff --git a/bin/varnishreplay/varnishreplay.c b/bin/varnishreplay/varnishreplay.c
index aec3f5f..d8d19d5 100644
--- a/bin/varnishreplay/varnishreplay.c
+++ b/bin/varnishreplay/varnishreplay.c
@@ -515,7 +515,7 @@ replay_thread(void *arg)
 		thread_log(2, 0, "%s(%s)", VSL_tags[tag], msg->ptr);
 
 		switch (tag) {
-		case SLT_ReqRequest:
+		case SLT_ReqMethod:
 			if (thr->method != NULL)
 				thr->bogus = 1;
 			else
diff --git a/bin/varnishtest/tests/a00001.vtc b/bin/varnishtest/tests/a00001.vtc
index 06b8ae5..0fc6de9 100644
--- a/bin/varnishtest/tests/a00001.vtc
+++ b/bin/varnishtest/tests/a00001.vtc
@@ -2,7 +2,7 @@ varnishtest "basic default HTTP transactions with expect"
 
 server s1 {
 	rxreq
-	expect req.request == GET
+	expect req.method == GET
 	expect req.proto == HTTP/1.1
 	expect req.url == "/"
 	txresp 
diff --git a/bin/varnishtest/tests/a00002.vtc b/bin/varnishtest/tests/a00002.vtc
index e0b4759..4d0f3df 100644
--- a/bin/varnishtest/tests/a00002.vtc
+++ b/bin/varnishtest/tests/a00002.vtc
@@ -2,7 +2,7 @@ varnishtest "basic default HTTP transactions with expect and options"
 
 server s1 {
 	rxreq
-	expect req.request == PUT
+	expect req.method == PUT
 	expect req.proto == HTTP/1.0
 	expect req.url == "/foo"
 	txresp -proto HTTP/1.2 -status 201 -msg Foo
diff --git a/bin/varnishtest/tests/a00003.vtc b/bin/varnishtest/tests/a00003.vtc
index 7462fb1..4982730 100644
--- a/bin/varnishtest/tests/a00003.vtc
+++ b/bin/varnishtest/tests/a00003.vtc
@@ -2,7 +2,7 @@ varnishtest "dual independent HTTP transactions"
 
 server s1 {
 	rxreq
-	expect req.request == PUT
+	expect req.method == PUT
 	expect req.proto == HTTP/1.0
 	expect req.url == "/foo"
 	txresp -proto HTTP/1.2 -status 201 -msg Foo
@@ -10,7 +10,7 @@ server s1 {
 
 server s2 {
 	rxreq
-	expect req.request == GET
+	expect req.method == GET
 	expect req.proto == HTTP/1.1
 	expect req.url == "/"
 	txresp 
diff --git a/bin/varnishtest/tests/a00004.vtc b/bin/varnishtest/tests/a00004.vtc
index 01cd868..7fbe476 100644
--- a/bin/varnishtest/tests/a00004.vtc
+++ b/bin/varnishtest/tests/a00004.vtc
@@ -2,7 +2,7 @@ varnishtest "dual shared server HTTP transactions"
 
 server s1 -repeat 2 {
 	rxreq
-	expect req.request == PUT
+	expect req.method == PUT
 	expect req.proto == HTTP/1.0
 	expect req.url == "/foo"
 	txresp -proto HTTP/1.2 -status 201 -msg Foo
diff --git a/bin/varnishtest/tests/a00005.vtc b/bin/varnishtest/tests/a00005.vtc
index e44a7e2..38ae1cf 100644
--- a/bin/varnishtest/tests/a00005.vtc
+++ b/bin/varnishtest/tests/a00005.vtc
@@ -2,7 +2,7 @@ varnishtest "dual shared client HTTP transactions"
 
 server s1 {
 	rxreq
-	expect req.request == PUT
+	expect req.method == PUT
 	expect req.proto == HTTP/1.0
 	expect req.url == "/foo"
 	txresp -proto HTTP/1.2 -status 201 -msg Foo
@@ -10,7 +10,7 @@ server s1 {
 
 server s2 {
 	rxreq
-	expect req.request == GET
+	expect req.method == GET
 	expect req.proto == HTTP/1.1
 	expect req.url == "/"
 	txresp 
diff --git a/bin/varnishtest/tests/a00006.vtc b/bin/varnishtest/tests/a00006.vtc
index 5db297b..bcd272f 100644
--- a/bin/varnishtest/tests/a00006.vtc
+++ b/bin/varnishtest/tests/a00006.vtc
@@ -2,7 +2,7 @@ varnishtest "bidirectional message bodies"
 
 server s1 {
 	rxreq
-	expect req.request == PUT
+	expect req.method == PUT
 	expect req.proto == HTTP/1.0
 	expect req.url == "/foo"
 	txresp -proto HTTP/1.2 -status 201 -msg Foo \
diff --git a/bin/varnishtest/tests/b00035.vtc b/bin/varnishtest/tests/b00035.vtc
new file mode 100644
index 0000000..9d49f4f
--- /dev/null
+++ b/bin/varnishtest/tests/b00035.vtc
@@ -0,0 +1,26 @@
+varnishtest "{be}req.request compat check"
+
+server s1 {
+	rxreq
+	expect req.method == "GETABCD"
+	txresp
+} -start
+
+varnish v1 -vcl+backend {
+
+	sub vcl_recv {
+		set req.method = req.request + "A";
+		set req.request = req.method + "B";
+		return (pass);
+	}
+
+	sub vcl_pass {
+		set bereq.method = bereq.request + "C";
+		set bereq.request = bereq.method + "D";
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+} -run
diff --git a/bin/varnishtest/tests/c00022.vtc b/bin/varnishtest/tests/c00022.vtc
index 33e20cc..64511fa 100644
--- a/bin/varnishtest/tests/c00022.vtc
+++ b/bin/varnishtest/tests/c00022.vtc
@@ -20,11 +20,11 @@ server s1 {
 
 varnish v1 -vcl+backend { 
 	sub vcl_recv {
-		if (req.request == "PURGE") {
+		if (req.method == "PURGE") {
 			ban ("req.url == " + req.url);
 			error 410;
 		}
-		if (req.request == "PURGESTR") {
+		if (req.method == "PURGESTR") {
 			ban ("" + req.http.ban);
 			error 410;
 		}
diff --git a/bin/varnishtest/tests/c00033.vtc b/bin/varnishtest/tests/c00033.vtc
index d4289e3..28b192d 100644
--- a/bin/varnishtest/tests/c00033.vtc
+++ b/bin/varnishtest/tests/c00033.vtc
@@ -18,19 +18,19 @@ server s1 {
 varnish v1 -vcl+backend {
 
 	sub vcl_recv {
-		if (req.request == "PURGE") {
+		if (req.method == "PURGE") {
 			return (lookup);
 		}
 	}
 
 	sub vcl_hit {
-		if (req.request == "PURGE") {
+		if (req.method == "PURGE") {
 			C{ VRT_purge(req, 0, 0); }C
 			error 456 "got it";
 		}
 	}
 	sub vcl_miss {
-		if (req.request == "PURGE") {
+		if (req.method == "PURGE") {
 			C{ VRT_purge(req, 0, 0); }C
 			error 456 "got it";
 		}
diff --git a/bin/varnishtest/tests/e00011.vtc b/bin/varnishtest/tests/e00011.vtc
index 8f03bd4..062b13a 100644
--- a/bin/varnishtest/tests/e00011.vtc
+++ b/bin/varnishtest/tests/e00011.vtc
@@ -2,14 +2,14 @@ varnishtest "Make sure that PASS'ed ESI requests use GET for includes"
 
 server s1 {
 	rxreq 
-	expect req.request == POST
+	expect req.method == POST
 	expect req.url == /foobar
 	txresp -body {<HTML>
 		FOO
 		<esi:include src="/bar"/>
 	}
 	rxreq
-	expect req.request == GET
+	expect req.method == GET
 	txresp -hdr "Set-Cookie: Foo=bar" -body {<HTML>
 		BAR
 	}
diff --git a/bin/varnishtest/tests/r00102.vtc b/bin/varnishtest/tests/r00102.vtc
index 0fa597b..8c0b784 100644
--- a/bin/varnishtest/tests/r00102.vtc
+++ b/bin/varnishtest/tests/r00102.vtc
@@ -9,8 +9,8 @@ server s1 {
 
 varnish v1 -vcl+backend { 
 	sub vcl_recv {
-		if (req.request == "POST") {
-			set req.request = "GET";
+		if (req.method == "POST") {
+			set req.method = "GET";
 		}
 	}
 } -start 
diff --git a/bin/varnishtest/tests/r00444.vtc b/bin/varnishtest/tests/r00444.vtc
index f71f905..ad8e12a 100644
--- a/bin/varnishtest/tests/r00444.vtc
+++ b/bin/varnishtest/tests/r00444.vtc
@@ -2,38 +2,38 @@ varnishtest "purging on POST"
 
 server s1 {
 	rxreq
-	expect req.request == "GET"
+	expect req.method == "GET"
 	txresp -body "1"
 
 	rxreq
-	expect req.request == "POST"
+	expect req.method == "POST"
 	txresp -body "22"
 
 	rxreq
-	expect req.request == "POST"
+	expect req.method == "POST"
 	txresp -body "333"
 
 	rxreq
-	expect req.request == "GET"
+	expect req.method == "GET"
 	txresp -body "4444"
 } -start
 
 varnish v1 -vcl+backend {
 	sub vcl_recv {
-		if (req.request == "POST") {
+		if (req.method == "POST") {
 			/* Lookup so we find any cached object */
 			return (lookup);
 		}
 	}
 	sub vcl_hit {
-		if (req.request == "POST") {
+		if (req.method == "POST") {
 			/* Get rid of this object */
 			set obj.ttl = 0s;
 			return (pass);
 		}
 	}
 	sub vcl_miss {
-		if (req.request == "POST") {
+		if (req.method == "POST") {
 			/* Make sure we don't cache the POST result */
 			return (pass);
 		}
diff --git a/bin/varnishtest/tests/r00679.vtc b/bin/varnishtest/tests/r00679.vtc
index a79b4c9..ba5ca68 100644
--- a/bin/varnishtest/tests/r00679.vtc
+++ b/bin/varnishtest/tests/r00679.vtc
@@ -2,7 +2,7 @@ varnishtest "pass + HEAD"
 
 server s1 {
 	rxreq
-	expect req.request == "HEAD"
+	expect req.method == "HEAD"
 	txresp 
 } -start
 
diff --git a/bin/varnishtest/tests/r01030.vtc b/bin/varnishtest/tests/r01030.vtc
index 8351d81..830e465 100644
--- a/bin/varnishtest/tests/r01030.vtc
+++ b/bin/varnishtest/tests/r01030.vtc
@@ -14,7 +14,7 @@ server s1 {
 
 varnish v1 -vcl+backend {
 	sub vcl_recv {
-		if (req.request == "BAN") {
+		if (req.method == "BAN") {
 			ban("obj.http.url ~ /");
 			error 201 "banned";
 		}
diff --git a/bin/varnishtest/tests/v00001.vtc b/bin/varnishtest/tests/v00001.vtc
index 644e737..922cd15 100644
--- a/bin/varnishtest/tests/v00001.vtc
+++ b/bin/varnishtest/tests/v00001.vtc
@@ -12,11 +12,11 @@ varnish v1 -vcl+backend {
 	sub vcl_recv {
 		set req.http.foobar =
 		    req.url +
-		    req.request +
+		    req.method +
 		    req.proto;
 		set req.url = "/";
 		set req.proto = "HTTP/1.2";
-		set req.request = "GET";
+		set req.method = "GET";
 	}
 	sub vcl_miss {
 		set bereq.http.foobar =
@@ -24,7 +24,7 @@ varnish v1 -vcl+backend {
 		    bereq.proto;
 		set bereq.url = "/";
 		set bereq.proto = "HTTP/1.2";
-		set bereq.request = "GET";
+		set bereq.method = "GET";
 	}
 	sub vcl_fetch {
 		set beresp.http.foobar =
diff --git a/bin/varnishtest/tests/v00011.vtc b/bin/varnishtest/tests/v00011.vtc
index dc8bd18..89119e4 100644
--- a/bin/varnishtest/tests/v00011.vtc
+++ b/bin/varnishtest/tests/v00011.vtc
@@ -10,7 +10,7 @@ server s1 {
 
 varnish v1 -vcl+backend { 
 	sub vcl_recv {
-		if (req.request == "PURGE") {
+		if (req.method == "PURGE") {
 			ban("req.url ~ ^/$");
 			error 209 "foo";
 		}
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index f867168..4d71ae9 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -175,7 +175,7 @@ cmd_var_resolve(struct http *hp, char *spec)
 {
 	char **hh, *hdr;
 
-	if (!strcmp(spec, "req.request"))
+	if (!strcmp(spec, "req.method"))
 		return(hp->req[0]);
 	if (!strcmp(spec, "req.url"))
 		return(hp->req[1]);
diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst
index 325470c..731da16 100644
--- a/doc/sphinx/reference/vcl.rst
+++ b/doc/sphinx/reference/vcl.rst
@@ -382,8 +382,8 @@ vcl_recv
   lookup  
     Look up the requested object in the cache.  Control will
     eventually pass to vcl_hit or vcl_miss, depending on whether the
-    object is in the cache.  The ``bereq.request`` value will be set
-    to ``GET`` regardless of the value of ``req.request``.
+    object is in the cache.  The ``bereq.method`` value will be set
+    to ``GET`` regardless of the value of ``req.method``.
 
 vcl_pipe
   Called upon entering pipe mode.  In this mode, the request is passed
@@ -619,9 +619,12 @@ server.ip
 server.port
   The port number of the socket on which the client connection was received.
 
-req.request
+req.method
   The request type (e.g. "GET", "HEAD").
 
+req.request
+  Outdated way to spell req.method.
+
 req.url
   The requested URL.
 
@@ -670,9 +673,12 @@ req.xid
 The following variables are available while preparing a backend
 request (either for a cache miss or for pass or pipe mode):
 
-bereq.request
+bereq.method
   The request type (e.g. "GET", "HEAD").
 
+bereq.request
+  Outdated way to spell bereq.method.
+
 bereq.url
   The requested URL.
 
@@ -913,7 +919,7 @@ documents even when cookies are present:
 ::
 
   sub vcl_recv {
-    if (req.request == "GET" && req.http.cookie) {
+    if (req.method == "GET" && req.http.cookie) {
        return(lookup);
     }
   }
@@ -934,7 +940,7 @@ for object invalidation:
   }
 
   sub vcl_recv {
-    if (req.request == "PURGE") {
+    if (req.method == "PURGE") {
       if (!client.ip ~ purge) {
         error 405 "Not allowed.";
       }
@@ -943,14 +949,14 @@ for object invalidation:
   }
 
   sub vcl_hit {
-    if (req.request == "PURGE") {
+    if (req.method == "PURGE") {
       purge;
       error 200 "Purged.";
     }
   }
 
   sub vcl_miss {
-    if (req.request == "PURGE") {
+    if (req.method == "PURGE") {
       purge;
       error 200 "Purged.";
     }
diff --git a/doc/sphinx/users-guide/devicedetection.rst b/doc/sphinx/users-guide/devicedetection.rst
index 13d501a..fc612e7 100644
--- a/doc/sphinx/users-guide/devicedetection.rst
+++ b/doc/sphinx/users-guide/devicedetection.rst
@@ -169,7 +169,7 @@ VCL::
     }
 
     sub append_ua {
-        if ((req.http.X-UA-Device) && (req.request == "GET")) {
+        if ((req.http.X-UA-Device) && (req.method == "GET")) {
             # if there are existing GET arguments;
             if (req.url ~ "\?") {
                 set req.http.X-get-devicetype = "&devicetype=" + req.http.X-UA-Device;
diff --git a/doc/sphinx/users-guide/purging.rst b/doc/sphinx/users-guide/purging.rst
index 53facd3..2402632 100644
--- a/doc/sphinx/users-guide/purging.rst
+++ b/doc/sphinx/users-guide/purging.rst
@@ -35,7 +35,7 @@ following VCL in place::
   sub vcl_recv {
       	  # allow PURGE from localhost and 192.168.55...
 
-	  if (req.request == "PURGE") {
+	  if (req.method == "PURGE") {
 		  if (!client.ip ~ purge) {
 			  error 405 "Not allowed.";
 		  }
@@ -44,14 +44,14 @@ following VCL in place::
   }
   
   sub vcl_hit {
-	  if (req.request == "PURGE") {
+	  if (req.method == "PURGE") {
 	          purge;
 		  error 200 "Purged.";
 	  }
   }
   
   sub vcl_miss {
-	  if (req.request == "PURGE") {
+	  if (req.method == "PURGE") {
 	          purge;
 		  error 200 "Purged.";
 	  }
@@ -110,7 +110,7 @@ impact CPU usage and thereby performance.
 You can also add bans to Varnish via HTTP. Doing so requires a bit of VCL::
 
   sub vcl_recv {
-	  if (req.request == "BAN") {
+	  if (req.method == "BAN") {
                   # Same ACL check as above:
 		  if (!client.ip ~ purge) {
 			  error 405 "Not allowed.";
@@ -142,7 +142,7 @@ You can use the following template to write ban lurker friendly bans::
   }
 
   sub vcl_recv {
-    if (req.request == "PURGE") {
+    if (req.method == "PURGE") {
       if (client.ip !~ purge) {
         error 401 "Not allowed";
       }
diff --git a/doc/sphinx/users-guide/vcl-examples.rst b/doc/sphinx/users-guide/vcl-examples.rst
index ffa730f..ea78b9b 100644
--- a/doc/sphinx/users-guide/vcl-examples.rst
+++ b/doc/sphinx/users-guide/vcl-examples.rst
@@ -43,7 +43,7 @@ the IP address of the client against an ACL with the match operator.::
   }
   
   sub vcl_recv {
-    if (req.request == "PURGE") {
+    if (req.method == "PURGE") {
       if (client.ip ~ local) {
          return(lookup);
       }
@@ -51,14 +51,14 @@ the IP address of the client against an ACL with the match operator.::
   }
   
   sub vcl_hit {
-     if (req.request == "PURGE") {
+     if (req.method == "PURGE") {
        set obj.ttl = 0s;
        error 200 "Purged.";
       }
   }
 
   sub vcl_miss {
-    if (req.request == "PURGE") {
+    if (req.method == "PURGE") {
       error 404 "Not in cache.";
     }
   }
diff --git a/etc/zope-plone.vcl b/etc/zope-plone.vcl
index 263e343..3127f18 100644
--- a/etc/zope-plone.vcl
+++ b/etc/zope-plone.vcl
@@ -38,15 +38,15 @@ sub vcl_recv {
         }
 
         # Handle special requests
-        if (req.request != "GET" && req.request != "HEAD") {
+        if (req.method != "GET" && req.method != "HEAD") {
 
                 # POST - Logins and edits
-                if (req.request == "POST") {
+                if (req.method == "POST") {
                         return(pass);
                 }
                 
                 # PURGE - The CacheFu product can invalidate updated URLs
-                if (req.request == "PURGE") {
+                if (req.method == "PURGE") {
                         if (!client.ip ~ purge) {
                                 error 405 "Not allowed.";
                         }
@@ -75,13 +75,13 @@ sub vcl_recv {
 
 # Do the PURGE thing
 sub vcl_hit {
-        if (req.request == "PURGE") {
+        if (req.method == "PURGE") {
                 purge;
                 error 200 "Purged";
         }
 }
 sub vcl_miss {
-        if (req.request == "PURGE") {
+        if (req.method == "PURGE") {
                 purge;
                 error 200 "Purged";
         }
diff --git a/include/tbl/vsl_tags_http.h b/include/tbl/vsl_tags_http.h
index 542af07..f515492 100644
--- a/include/tbl/vsl_tags_http.h
+++ b/include/tbl/vsl_tags_http.h
@@ -32,7 +32,7 @@
  *
  */
 
-SLTH(Request,	HTTP_HDR_REQ)
+SLTH(Method,	HTTP_HDR_METHOD)
 SLTH(URL,	HTTP_HDR_URL)
 SLTH(Protocol,	HTTP_HDR_PROTO)
 SLTH(Status,	HTTP_HDR_STATUS)
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index 45f015e..2064b82 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -139,6 +139,12 @@ sp_variables = (
 		( ),
 		'struct req *'
 	),
+	('req.method',
+		'STRING',
+		( 'proc',),
+		( 'proc',),
+		'const struct req *'
+	),
 	('req.request',
 		'STRING',
 		( 'proc',),
@@ -235,6 +241,12 @@ sp_variables = (
 		( 'recv',),
 		'struct req *'
 	),
+	('bereq.method',
+		'STRING',
+		( 'pipe', 'pass', 'miss', 'fetch',),
+		( 'pipe', 'pass', 'miss', 'fetch',),
+		'const struct req *'
+	),
 	('bereq.request',
 		'STRING',
 		( 'pipe', 'pass', 'miss', 'fetch',),



More information about the varnish-commit mailing list