From: Jan Breuer Date: Wed, 15 Feb 2017 17:58:55 +0000 (+0100) Subject: Fix #1114 HttpUtils getGitblitURL does not support nonstandard ports X-Git-Tag: r1.9.0~55^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=49bec41a98520c7e11027c681b885ab1154a99a5;p=gitblit.git Fix #1114 HttpUtils getGitblitURL does not support nonstandard ports X-Forwarded-Host can contain port number and it is added twice in that situation This fix just prevent adding port number if it is already there --- diff --git a/src/main/java/com/gitblit/utils/HttpUtils.java b/src/main/java/com/gitblit/utils/HttpUtils.java index 2fd8d898..27df5a52 100644 --- a/src/main/java/com/gitblit/utils/HttpUtils.java +++ b/src/main/java/com/gitblit/utils/HttpUtils.java @@ -110,7 +110,9 @@ public class HttpUtils { sb.append(host); if (("http".equals(scheme) && port != 80) || ("https".equals(scheme) && port != 443)) { - sb.append(":").append(port); + if (!host.endsWith(":" + port)) { + sb.append(":").append(port); + } } sb.append(context); return sb.toString();