[experimental-ims] 099c22c Request specific variables are not available in vcl_init{} and vcl_fini{}

Geoff Simmons geoff at varnish-cache.org
Fri Jul 8 11:47:36 CEST 2011


commit 099c22c01cadd01ef96d98f77e0c0e2b173f6ae6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jun 16 06:25:44 2011 +0000

    Request specific variables are not available in vcl_init{} and vcl_fini{}

diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index ffb8a08..5407a51 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -98,107 +98,110 @@ returns =(
 
 #######################################################################
 # Variables available in sessions
+#
+# 'all' means all methods
+# 'proc' means all methods but 'init' and 'fini'
 
 sp_variables = (
 	('client.ip',
 		'IP',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'const struct sess *'
 	),
 	('client.identity',
 		'STRING',
-		( 'all',),
-		( 'all',),
+		( 'proc',),
+		( 'proc',),
 		'struct sess *'
 	),
 	('server.ip',
 		'IP',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'struct sess *'
 	),
 	('server.hostname',
 		'STRING',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'struct sess *'
 	),
 	('server.identity',
 		'STRING',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'struct sess *'
 	),
 	('server.port',
 		'INT',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'struct sess *'
 	),
 	('req.request',
 		'STRING',
-		( 'all',),
-		( 'all',),
+		( 'proc',),
+		( 'proc',),
 		'const struct sess *'
 	),
 	('req.url',
 		'STRING',
-		( 'all',),
-		( 'all',),
+		( 'proc',),
+		( 'proc',),
 		'const struct sess *'
 	),
 	('req.proto',
 		'STRING',
-		( 'all',),
-		( 'all',),
+		( 'proc',),
+		( 'proc',),
 		'const struct sess *'
 	),
 	('req.http.',
 		'HDR_REQ',
-		( 'all',),
-		( 'all',),
+		( 'proc',),
+		( 'proc',),
 		'const struct sess *'
 	),
 	('req.backend',
 		'BACKEND',
-		( 'all',),
-		( 'all',),
+		( 'proc',),
+		( 'proc',),
 		'struct sess *'
 	),
 	('req.restarts',
 		'INT',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'const struct sess *'
 	),
 	('req.esi_level',
 		'INT',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'const struct sess *'
 	),
 	('req.ttl',
 		'DURATION',
-		( 'all',),
-		( 'all',),
+		( 'proc',),
+		( 'proc',),
 		'struct sess *'
 	),
 	('req.grace',
 		'DURATION',
-		( 'all',),
-		( 'all',),
+		( 'proc',),
+		( 'proc',),
 		'struct sess *'
 	),
 	('req.keep',
 		'DURATION',
-		( 'all',),
-		( 'all',),
+		( 'proc',),
+		( 'proc',),
 		'struct sess *'
 	),
 	('req.xid',
 		'STRING',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'struct sess *'
 	),
@@ -210,13 +213,13 @@ sp_variables = (
 	),
 	('req.can_gzip',
 		'BOOL',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'struct sess *'
 	),
 	('req.backend.healthy',
 		'BOOL',
-		( 'all',),
+		( 'proc',),
 		( ),
 		'const struct sess *'
 	),
@@ -773,6 +776,11 @@ def restrict(fo, spec):
 		return
 	if spec[0] == 'all':
 		spec = vcls
+	if spec[0] == 'proc':
+		spec = list()
+		for i in vcls:
+			if i != "init" and i != "fini":
+				spec.append(i)
 	p = ""
 	n = 0
 	for j in spec:



More information about the varnish-commit mailing list