Skip to content

Commit

Permalink
Fix gitblit-org#1114 HttpUtils getGitblitURL does not support nonstan…
Browse files Browse the repository at this point in the history
…dard 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
  • Loading branch information
j123b567 committed Feb 15, 2017
1 parent b03fc53 commit 49bec41
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/gitblit/utils/HttpUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ public static String getGitblitURL(HttpServletRequest request) {
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();
Expand Down

0 comments on commit 49bec41

Please sign in to comment.