From 1ee7b53a1c68ccb4fa7122204b17c03721cc7e79 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 30 Sep 2013 01:04:36 -0600 Subject: [PATCH] Tests: Add regression tests for squid.conf parser 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 | 2 ++ test-suite/squidconf/regressions-3.4.0.1 | 41 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test-suite/squidconf/regressions-3.4.0.1 diff --git a/src/ConfigParser.cc b/src/ConfigParser.cc index e68a977a1c..e0a66cfda1 100644 --- a/src/ConfigParser.cc +++ b/src/ConfigParser.cc @@ -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 index 0000000000..f87ec4f63b --- /dev/null +++ b/test-suite/squidconf/regressions-3.4.0.1 @@ -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 -- 2.47.2