From 49bec41a98520c7e11027c681b885ab1154a99a5 Mon Sep 17 00:00:00 2001 From: Jan Breuer Date: Wed, 15 Feb 2017 18:58:55 +0100 Subject: [PATCH] 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 --- src/main/java/com/gitblit/utils/HttpUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); -- 2.39.5