Skip to content

Commit fadfb06

Browse files
committed
merge in main
2 parents d77627f + ced766d commit fadfb06

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
@@ -162,8 +162,8 @@ public void getIPAddress() {
162162
@Test
163163
public void hostHeaderPortHandling() {
164164
// positive cases
165-
assertURLs("http", "myhost", "myhost", -1, "http://myhost");
166-
assertURLs("https", "myhost", "myhost", -1, "https://myhost");
165+
assertURLs("http", "myhost", "myhost", 80, "http://myhost");
166+
assertURLs("https", "myhost", "myhost", 443, "https://myhost");
167167
assertURLs("http", "myhost:80", "myhost", 80, "http://myhost");
168168
assertURLs("https", "myhost:80", "myhost", 80, "https://myhost:80");
169169
assertURLs("http", "myhost:443", "myhost", 443, "http://myhost:443");

0 commit comments

Comments
 (0)