[master] 298475e Make the default return from recv and hash methods point to the next method we'll end up in.

Poul-Henning Kamp phk at varnish-cache.org
Tue May 7 10:13:41 CEST 2013


commit 298475ebb70ba6ab4a25116e2292bc33d77fd51c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue May 7 08:13:17 2013 +0000

    Make the default return from recv and hash methods point to the
    next method we'll end up in.

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 77a4688..90a4a1a 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -1172,7 +1172,7 @@ cnt_recv(struct worker *wrk, struct req *req)
 	req->sha256ctx = &sha256ctx;	/* so HSH_AddString() can find it */
 	SHA256_Init(req->sha256ctx);
 	VCL_hash_method(req->vcl, wrk, req, NULL, req->http->ws);
-	assert(wrk->handling == VCL_RET_HASH);
+	assert(wrk->handling == VCL_RET_LOOKUP);
 	SHA256_Final(req->digest, req->sha256ctx);
 	req->sha256ctx = NULL;
 
@@ -1182,7 +1182,7 @@ cnt_recv(struct worker *wrk, struct req *req)
 		req->wantbody = 1;
 
 	switch(recv_handling) {
-	case VCL_RET_LOOKUP:
+	case VCL_RET_HASH:
 		req->req_step = R_STP_LOOKUP;
 		return (REQ_FSM_MORE);
 	case VCL_RET_PIPE:
diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl
index f4137b4..4918349 100644
--- a/bin/varnishd/default.vcl
+++ b/bin/varnishd/default.vcl
@@ -66,7 +66,7 @@ sub vcl_recv {
         /* Not cacheable by default */
         return (pass);
     }
-    return (lookup);
+    return (hash);
 }
 
 sub vcl_pipe {
@@ -90,7 +90,7 @@ sub vcl_hash {
     } else {
         hash_data(server.ip);
     }
-    return (hash);
+    return (lookup);
 }
 
 sub vcl_lookup {
diff --git a/bin/varnishtest/tests/c00033.vtc b/bin/varnishtest/tests/c00033.vtc
index 7f0bda3..b88acfa 100644
--- a/bin/varnishtest/tests/c00033.vtc
+++ b/bin/varnishtest/tests/c00033.vtc
@@ -19,7 +19,7 @@ varnish v1 -vcl+backend {
 
 	sub vcl_recv {
 		if (req.method == "PURGE") {
-			return (lookup);
+			return (hash);
 		}
 	}
 
diff --git a/bin/varnishtest/tests/r00444.vtc b/bin/varnishtest/tests/r00444.vtc
index 85bdc15..2448b93 100644
--- a/bin/varnishtest/tests/r00444.vtc
+++ b/bin/varnishtest/tests/r00444.vtc
@@ -22,7 +22,7 @@ varnish v1 -vcl+backend {
 	sub vcl_recv {
 		if (req.method == "POST") {
 			/* Lookup so we find any cached object */
-			return (lookup);
+			return (hash);
 		}
 	}
 	sub vcl_lookup {
diff --git a/bin/varnishtest/tests/r00965.vtc b/bin/varnishtest/tests/r00965.vtc
index 865e16a..b3a1299 100644
--- a/bin/varnishtest/tests/r00965.vtc
+++ b/bin/varnishtest/tests/r00965.vtc
@@ -14,7 +14,7 @@ varnish v1 -vcl+backend {
 			if (req.http.x-pass) {
 				return (pass);
 			} else {
-				return (lookup);
+				return (hash);
 			}
 		}
 	}
@@ -23,7 +23,7 @@ varnish v1 -vcl+backend {
 		## Check if they have a ban in the cache, or if they are going to be banned in cache.
 		if (req.http.X-Banned) {
 			hash_data(client.ip);
-			return (hash);
+			return (lookup);
 		}
 	}
 
diff --git a/bin/varnishtest/tests/r01030.vtc b/bin/varnishtest/tests/r01030.vtc
index a746852..f8aa7fb 100644
--- a/bin/varnishtest/tests/r01030.vtc
+++ b/bin/varnishtest/tests/r01030.vtc
@@ -18,7 +18,7 @@ varnish v1 -vcl+backend {
 			ban("obj.http.url ~ /");
 			error 201 "banned";
 		}
-		return (lookup);
+		return (hash);
 	}
 	sub vcl_backend_response {
 		set beresp.http.url = bereq.url;
diff --git a/bin/varnishtest/tests/r01296.vtc b/bin/varnishtest/tests/r01296.vtc
index f9f8de4..1683d92 100644
--- a/bin/varnishtest/tests/r01296.vtc
+++ b/bin/varnishtest/tests/r01296.vtc
@@ -15,7 +15,7 @@ varnish v1 -vcl+backend {
 		} else {
 			hash_data("1" + req.http.foo + "3");
 		}
-		return (hash);
+		return (lookup);
 	}
 } -start
 
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index 0f6bfe8..349500a 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -78,10 +78,10 @@ tokens = {
 # Our methods and actions
 
 returns =(
-	('recv',		"C", ('error', 'pass', 'pipe', 'lookup',)),
+	('recv',		"C", ('error', 'pass', 'pipe', 'hash',)),
 	('pipe',		"C", ('error', 'pipe',)),
 	('pass',		"C", ('error', 'restart', 'pass',)),
-	('hash',		"C", ('hash',)),
+	('hash',		"C", ('lookup',)),
 	('miss',		"C", ('error', 'restart', 'pass', 'fetch',)),
 	('lookup',		"C", ('error', 'restart', 'pass', 'deliver',)),
 	('backend_fetch',	"B", ('fetch', 'pass',)),



More information about the varnish-commit mailing list