]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Tests: Add regression tests for squid.conf parser
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 30 Sep 2013 07:04:36 +0000 (01:04 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 30 Sep 2013 07:04:36 +0000 (01:04 -0600)
Regressions identified by the community in active production configs
with the 3.4.0.1 parser upgrade attempt.

Also, disables %macro detection inside quoted-strings. Which is still
encountering errors in the current 3.HEAD code.

src/ConfigParser.cc
test-suite/squidconf/regressions-3.4.0.1 [new file with mode: 0644]

index e68a977a1c89a94d7e524be1710c366034e2a89a..e0a66cfda1302b4e513415d5ee5b76f646e95f7f 100644 (file)
@@ -214,9 +214,11 @@ ConfigParser::UnQuote(const char *token, const char **next)
             errorStr = "Unsupported cfg macro";
             errorPos = s;
 #endif
+#if 0
         } else if (*s == '%' && quoteChar == '"' && (!AllowMacros_ )) {
             errorStr = "Macros are not supported here";
             errorPos = s;
+#endif
         } else
             *d = *s;
         ++s;
diff --git a/test-suite/squidconf/regressions-3.4.0.1 b/test-suite/squidconf/regressions-3.4.0.1
new file mode 100644 (file)
index 0000000..f87ec4f
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# This file contains the list of reported regression cases in 3.4.0.1 parser
+# it covers various uses of:
+#      folded lines
+#      bare macro token
+#      key=value tokens
+#      helper command line
+#      quoted file include
+#      regular expressions
+#      percentage token
+#      bare double-quote characters (escaped and unescaped)
+#      false-positive quoted-string token
+#
+
+external_acl_type LdapGroup children-max=30 children-startup=10 concurrency=0 ttl=600 negative_ttl=10 grace=0 protocol=2.5 %LOGIN \
+  /bin/true -v 3 -h 127.0.0.1 -b "o=A,c=INVALID" -B "org=borken?,ou=People,o=A,c=INVALID" -f "(&(cn=%g)(memberUid=%u))" \
+  -F "(&(objectClass=account)(uid=%s))" -s sub 
+
+acl Mark dstdomain "empty"
+
+refresh_pattern "foo 0 80% 20160
+refresh_pattern "foo\" 0 80% 20160
+refresh_pattern foo\" 0 80% 20160
+
+
+refresh_pattern -i bar.com.invalid/.*\.(cab|exe|ms[i|u|f]|asf|wm[v|a]|dat|zip) 4320 90% 43200
+refresh_pattern -i foo.com.invalid.*\.(cab|exe|ms[i|u|f]|asf|wm[v|a]|dat|zip) 4320 90% 43200
+
+refresh_pattern http://download\.foo\.invalid/ 0 80% 20160
+refresh_pattern ftp://ftp\.bar\.invalid/ 0 80% 20160
+refresh_pattern http://ftp\.software\.invalid/ 0 80% 20160
+
+# Others
+refresh_pattern -i \.mp4 1440 90% 43200
+refresh_pattern -i \.(gif|png|jpg|jpeg|ico)$ 40320 75% 86400
+refresh_pattern -i \.(iso|avi|wav|mp3|mpeg|swf|flv|x-flv)$ 1440 40% 40320
+
+refresh_pattern ^ftp:           1440    20%     10080
+refresh_pattern ^gopher:        1440    0%      1440
+refresh_pattern -i (/cgi-bin/|\?)       0       0%      0
+refresh_pattern .       0       20%     4320