[master] c2bfe9d Tolerate whitespace in declarations

Nils Goroll nils.goroll at uplex.de
Tue Aug 30 23:06:10 CEST 2016


commit c2bfe9d090a8f9383f2840edae05157966bb729c
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Aug 30 23:04:06 2016 +0200

    Tolerate whitespace in declarations
    
    This fixes a regression against 4.1
    
    Reported by Dridi

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 6377adc..944df58 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -244,12 +244,12 @@ def arg(txt):
 		i = s.find(',')
 		if i < 0:
 			i = len(s)
-		a.nm = s[:i]
+		a.nm = s[:i].rstrip()
 		s = s[i:]
 		return a, s
 
-	a.nm = s[:i]
-	s = s[i+1:]
+	a.nm = s[:i].rstrip()
+	s = s[i+1:].lstrip()
 	if s[0] == '"' or s[0] == "'":
 		m = re.match("(['\"]).*?(\\1)", s)
 		if not m:
@@ -260,7 +260,7 @@ def arg(txt):
 		i = s.find(',')
 		if i < 0:
 			i = len(s)
-		a.defval = s[:i]
+		a.defval = s[:i].rstrip()
 		s = s[i:]
 
 	return a,s
@@ -294,6 +294,7 @@ class prototype(object):
 		while len(s) > 0:
 			a,s = arg(s)
 			self.args.append(a)
+			s = s.lstrip()
 			if len(s) == 0:
 				break;
 			assert s[0] == ','
diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc
index a3699bd..973337d 100644
--- a/lib/libvmod_debug/vmod.vcc
+++ b/lib/libvmod_debug/vmod.vcc
@@ -103,8 +103,8 @@ Encrypt the HTTP header with quad-ROT13 encryption,
 (this is approx 33% better than triple-DES).
 
 $Function STRING argtest(
-	  STRING one, REAL two=2, STRING three="3",
-	  STRING comma=",", INT four=4)
+	  STRING one, REAL two =2, STRING three= "3",
+	  STRING comma="," , INT four = 4 )
 
 $Function INT vre_limit()
 



More information about the varnish-commit mailing list