]> git.ipfire.org Git - thirdparty/squid.git/commit - src/ConfigParser.h
Moved regcomp(3)-specific RegexPattern code inside RegexPattern (#972)
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 4 Feb 2022 14:25:58 +0000 (14:25 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 4 Feb 2022 14:33:31 +0000 (14:33 +0000)
commit0fa036e32cfa348ed90d849699ee0a2918b415f1
tree9acbb991615f8ad2359cc64cdf150eddf976ca81
parent61be1d8eeb035b2ef4c6c78783160a233998c75c
Moved regcomp(3)-specific RegexPattern code inside RegexPattern (#972)

Also moved non-ACL regex configuration parsing code inside ConfigParser.
It is possible to move ACL (data) regex configuration parsing code as
well, but that move is a lot more complex due to regex-pattern-joining
optimizations, and there are no immediate plans to support
non-regcomp(3) regexes in ACL data. We may do that move later as we get
more experience with non-regcomp(3) regexes and decide to join them too.

These moves clean up existing regex-using code and allow adding support
for non-regcomp(3) regexes (e.g., regexes based on C++11 <regex>)
without adjusting ConfigParser::regex() callers. Such support would also
require "virtualizing" RegexPattern. To avoid increasing complexity and
hurting performance, that (simpler) step should be done only if we
decide to actually add support for non-regcomp(3) regexes.

The above changes allowed us to improve RegexData error reporting: Squid
no longer reports REs _optimization_ failure when it is an individual RE
that is broken (and reported as such). Squid still ignores the fact that
broken REs can be "optimized" into a completely "different" valid
combined RE: We do not compile individual REs unless optimization fails.

Also simplified and polished affected code.
src/ConfigParser.cc
src/ConfigParser.h
src/RefreshPattern.h
src/acl/RegexData.cc
src/base/RegexPattern.cc
src/base/RegexPattern.h
src/base/forward.h
src/cache_cf.cc
src/refresh.cc