diff options
author | Valerij Fredriksen <valerijf@verizonmedia.com> | 2021-07-29 12:12:44 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@verizonmedia.com> | 2021-07-29 12:12:44 +0200 |
commit | 9bf093921bf9ec45132fba05de54146ffcbbfc24 (patch) | |
tree | df21b87a09d7bb1714c6933557e6eac85fa9aeeb /container-core | |
parent | fa71d089f71d3652eab4c63e0aff869ae45c916d (diff) |
Use the port from the request
Diffstat (limited to 'container-core')
-rw-r--r-- | container-core/src/main/java/com/yahoo/jdisc/http/filter/util/FilterUtils.java | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/filter/util/FilterUtils.java b/container-core/src/main/java/com/yahoo/jdisc/http/filter/util/FilterUtils.java index 1af39e2d073..4a101588877 100644 --- a/container-core/src/main/java/com/yahoo/jdisc/http/filter/util/FilterUtils.java +++ b/container-core/src/main/java/com/yahoo/jdisc/http/filter/util/FilterUtils.java @@ -64,16 +64,8 @@ public class FilterUtils { } public static URI createUriFromRequest(DiscFilterRequest request, String path) { - Optional<Integer> port = Optional.empty(); try { - port = Optional.ofNullable(request.getHeader("Host")) - .flatMap(host -> Optional.of(host.lastIndexOf(':') + 1) - .filter(i -> i > 0) - .map(index -> Integer.parseInt(host.substring(index)))); - } catch (NumberFormatException ignored) { } - - try { - return new URI(request.getScheme(), null, request.getServerName(), port.orElse(-1), path, null, null); + return new URI(request.getScheme(), null, request.getServerName(), request.getUri().getPort(), path, null, null); } catch (URISyntaxException e) { throw new RuntimeException(e); } |