Skip to content

Commit ced766d

Browse files
authored
Merge pull request #44 from MarekUniq/bugfix/issue-3207-http-https-default-port
Original missing port should not be ignored. Fixes https://github.com…
2 parents 1312fd7 + 31994c3 commit ced766d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/main/java/io/fusionauth/http/server/HTTPRequest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,14 @@ private void decodeHeader(String name, String value) {
801801
}
802802
}
803803
} else {
804+
if ("http".equalsIgnoreCase(scheme)) {
805+
this.port = 80;
806+
}
807+
else if ("https".equalsIgnoreCase(scheme)) {
808+
this.port = 443;
809+
} else {
810+
// fallback, intentionally do nothing
811+
}
804812
this.host = value;
805813
}
806814
break;

src/test/java/io/fusionauth/http/HTTPRequestTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ public void getIPAddress() {
137137
@Test
138138
public void hostHeaderPortHandling() {
139139
// positive cases
140-
assertURLs("http", "myhost", "myhost", -1, "http://myhost");
141-
assertURLs("https", "myhost", "myhost", -1, "https://myhost");
140+
assertURLs("http", "myhost", "myhost", 80, "http://myhost");
141+
assertURLs("https", "myhost", "myhost", 443, "https://myhost");
142142
assertURLs("http", "myhost:80", "myhost", 80, "http://myhost");
143143
assertURLs("https", "myhost:80", "myhost", 80, "https://myhost:80");
144144
assertURLs("http", "myhost:443", "myhost", 443, "http://myhost:443");

0 commit comments

Comments
 (0)