diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-04-02 15:53:31 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-04-03 17:24:40 +0200 |
commit | 555d9c5ed27e57a0e58cc1b8c79b0df97d4fa9be (patch) | |
tree | 70fe5ed88c1aeb837c86001be5df651114c6c7c9 /jdisc_core/src/main/java | |
parent | bc8bfdcbf85b0be52997442345e5e3c4269cad18 (diff) |
Handle 'https' scheme in uri pattern matching as 'http'
Diffstat (limited to 'jdisc_core/src/main/java')
-rw-r--r-- | jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java b/jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java index 0e6e5d28260..350d8170987 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java @@ -65,7 +65,7 @@ public class UriPattern implements Comparable<UriPattern> { if (!matcher.find()) { throw new IllegalArgumentException(uri); } - scheme = GlobPattern.compile(resolvePatternComponent(matcher.group(1))); + scheme = GlobPattern.compile(normalizeScheme(resolvePatternComponent(matcher.group(1)))); host = GlobPattern.compile(resolvePatternComponent(matcher.group(2))); port = resolvePortPattern(matcher.group(4)); path = GlobPattern.compile(resolvePatternComponent(matcher.group(7))); @@ -91,7 +91,7 @@ public class UriPattern implements Comparable<UriPattern> { return null; } // Match scheme before host because it has a higher chance of differing (e.g. http versus https) - GlobPattern.Match schemeMatch = scheme.match(resolveUriComponent(uri.getScheme())); + GlobPattern.Match schemeMatch = scheme.match(normalizeScheme(resolveUriComponent(uri.getScheme()))); if (schemeMatch == null) { return null; } @@ -172,6 +172,11 @@ public class UriPattern implements Comparable<UriPattern> { } } + private static String normalizeScheme(String scheme) { + if (scheme.equals("https")) return "http"; // handle 'https' in bindings and uris as 'http' + return scheme; + } + /** * <p>This class holds the result of a {@link UriPattern#match(URI)} operation. It contains methods to inspect the * groups captured during matching, where a <em>group</em> is defined as a sequence of characters matches by a |