Let me begin by thanking you for bringing this downright necessary extension into existence. This PR contains an implementation of the most requested feature: wildcard support. The attempt was to stay as close to the original source as reasonable. A summary of the changes:
A path is required. A simple '/' at the end of the hostname is all that is necessary. If not specified in the input, it is appended.
A wildcard leads to a matching of all present qualifiers. For instance, *.example.com will check for example.com, and if this matches then the rule matches (example.com, here.example.com, and here.there.example.com will all match).
A wildcard is implied in the path. This is simply because the path is to a folder and not a specific file, and so any file in the shoulder should match the rule (the map). Thus, any wildcards in the path are stripped: example.com/* is equivalent to example.com/.
All maps are sorted before attempting to match to a URI. This sort is from most the least complex, which makes sure that a rule for here.example.com/ is matched before *.example.com/. The complexity is determined by the number of domains, then the number of paths.
More tests were added to check for this functionality. While not exhaustively tested, I've used it for half a week, with this final version having no real issues.
*As for backwards compatibility, the only change is the inclusion of a slash at the end of rules with no paths. This last commit includes a fix for maps already in storage: when a URI is checked, all old maps are updated.
I encourage you to review this PR, and hope it serves at the very least as inspiration on how to implement this feature.
Let me begin by thanking you for bringing this downright necessary extension into existence. This PR contains an implementation of the most requested feature: wildcard support. The attempt was to stay as close to the original source as reasonable. A summary of the changes:
*.example.com
will check forexample.com
, and if this matches then the rule matches (example.com
,here.example.com
, andhere.there.example.com
will all match).example.com/*
is equivalent toexample.com/
.here.example.com/
is matched before*.example.com/
. The complexity is determined by the number of domains, then the number of paths.I encourage you to review this PR, and hope it serves at the very least as inspiration on how to implement this feature.