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 2fd8d89..27df5a5 100644
--- a/src/main/java/com/gitblit/utils/HttpUtils.java
+++ b/src/main/java/com/gitblit/utils/HttpUtils.java
@@ -110,7 +110,9 @@
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();