diff options
author | bjormel <bjormel@yahooinc.com> | 2023-10-26 13:59:28 +0000 |
---|---|---|
committer | bjormel <bjormel@yahooinc.com> | 2023-10-26 13:59:28 +0000 |
commit | 567be9a1f6353cec41c23bfd1fcd46b4b2a4d2d7 (patch) | |
tree | 4664a743e166a5e11aee7b9acd70ad8ee2617612 /vespajlib/src/main/java/com/yahoo/net/Url.java | |
parent | e9058b555d4dfea2f6c872d9a677e8678b569569 (diff) | |
parent | bce3b8e926bf9da880172acbe1ba4b12d5e026d6 (diff) |
Merge branch 'master' into bjormel/aws-main-controllerbjormel/aws-main-controller
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/net/Url.java')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/net/Url.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/net/Url.java b/vespajlib/src/main/java/com/yahoo/net/Url.java index e6e7512c9f8..1b931ca898f 100644 --- a/vespajlib/src/main/java/com/yahoo/net/Url.java +++ b/vespajlib/src/main/java/com/yahoo/net/Url.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.net; import java.util.regex.Matcher; @@ -10,9 +10,9 @@ import java.util.regex.Pattern; public class Url { private static final Pattern pattern = Pattern.compile( - //12 3 456 7 8 9ab c d e f g h i j - // 2 1 6 87 5 c b ed a4 f hg ji - "^(([^:/?#]+):)?(//((([^:@/?#]+)(:([^@/?#]+))?@))?(((\\[([^\\]]+)\\]|[^:/?#]+)(:([^/?#]+))?)))?([^?#]+)?(\\?([^#]*))?(#(.*))?"); + //12 3 45 6 7 89 a b c d e f g h + // 2 1 5 76 4 a 9 cb 8 d fe hg + "^(([^:/?#]+):)?(//(([^:@/?#]+)(:([^@/?#]+))?@)?((\\[([^]]+)]|[^:/?#]+)(:([^/?#]+))?))?([^?#]+)?(\\?([^#]*))?(#(.*))?"); private final String image; private final int schemeBegin; private final int schemeEnd; @@ -122,17 +122,17 @@ public class Url { if (!matcher.matches()) { throw new IllegalArgumentException("Malformed URL."); } - String host = matcher.group(12); + String host = matcher.group(10); if (host == null) { - host = matcher.group(11); + host = matcher.group(9); } if (host == null) { - host = matcher.group(9); + host = matcher.group(8); } - String port = matcher.group(14); - return new Url(matcher.group(2), matcher.group(6), matcher.group(8), host, - port != null ? Integer.valueOf(port) : null, matcher.group(15), matcher.group(17), - matcher.group(19)); + String port = matcher.group(12); + return new Url(matcher.group(2), matcher.group(5), matcher.group(7), host, + port != null ? Integer.valueOf(port) : null, matcher.group(13), matcher.group(15), + matcher.group(17)); } public int getSchemeBegin() { |