aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorn.christian@seime.no>2019-04-03 16:04:43 +0200
committerGitHub <noreply@github.com>2019-04-03 16:04:43 +0200
commitb5892b7f165d0aea3910cbaaca8f049ce425b137 (patch)
tree486739edf8dbca1082c46f33211a6bdb90f06463 /jdisc_core
parentea56eae3f73af014d90956a96c719b94efc7ed5a (diff)
Revert "Handle 'https' scheme in uri pattern matching as 'http'"
Diffstat (limited to 'jdisc_core')
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java9
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java9
2 files changed, 2 insertions, 16 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 350d8170987..0e6e5d28260 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(normalizeScheme(resolvePatternComponent(matcher.group(1))));
+ scheme = GlobPattern.compile(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(normalizeScheme(resolveUriComponent(uri.getScheme())));
+ GlobPattern.Match schemeMatch = scheme.match(resolveUriComponent(uri.getScheme()));
if (schemeMatch == null) {
return null;
}
@@ -172,11 +172,6 @@ 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
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java
index d2499bbf369..c91a7134c3a 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java
@@ -295,15 +295,6 @@ public class UriPatternTestCase {
assertMatch(httpsPattern, "https://host/path", NO_GROUPS);
}
- @Test
- public void requireThatHttpsSchemeIsHandledAsHttp() {
- UriPattern httpPattern = new UriPattern("http://host:80/path");
- assertMatch(httpPattern, "https://host:80/path", NO_GROUPS);
-
- UriPattern httpsPattern = new UriPattern("https://host:443/path");
- assertMatch(httpsPattern, "http://host:443/path", NO_GROUPS);
- }
-
private static void assertIllegalPattern(String uri) {
try {
new UriPattern(uri);