normalize 443

This commit is contained in:
Ciro Spaciari
2025-02-20 13:17:34 -08:00
parent 6d6dc39565
commit cc62349f00
3 changed files with 9 additions and 2 deletions

View File

@@ -3340,7 +3340,7 @@ fn NewSocket(comptime ssl: bool) type {
if (servername == null) {
return JSValue.jsUndefined();
}
return ZigString.fromUTF8(servername[0..bun.len(servername)]).toJS(globalObject);
return bun.String.createUTF8ForJS(globalObject, servername[0..bun.len(servername)]);
}
pub fn setServername(
this: *This,

View File

@@ -2299,7 +2299,7 @@ function initOriginSet(session: Http2Session) {
}
}
let originString = `https://${hostName}`;
if (socket.remotePort != null) originString += `:${socket.remotePort}`;
if (socket.remotePort != null && socket.remotePort != 443) originString += `:${socket.remotePort}`;
originSet.add(originString);
}
return originSet;

View File

@@ -4,6 +4,13 @@ import { tls } from "harness";
import http2 from "http2";
import { once } from "events";
test("can make http2 request using servername", async () => {
// actually using a servername
const response = await got("https://example.com", {
http2: true,
});
expect(response.statusCode).toBe(200);
});
test("can make http2 request to local http2 server", async () => {
const server = http2.createSecureServer(tls);