diff options
author | Jan Breuer <jan.breuer@mobatime.cz> | 2017-02-15 18:58:55 +0100 |
---|---|---|
committer | Jan Breuer <jan.breuer@mobatime.cz> | 2017-02-15 18:58:55 +0100 |
commit | 49bec41a98520c7e11027c681b885ab1154a99a5 (patch) | |
tree | 10d260fb1be9a05a886630ee4bcaa662dc9dfc45 /src/main/java | |
parent | b03fc536a398a294f52d91441cbddbad392b1ae6 (diff) | |
download | gitblit-49bec41a98520c7e11027c681b885ab1154a99a5.tar.gz gitblit-49bec41a98520c7e11027c681b885ab1154a99a5.zip |
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
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/gitblit/utils/HttpUtils.java | 4 |
1 files changed, 3 insertions, 1 deletions
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();
|