aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ciro Spaciari <ciro.spaciari@gmail.com> 2023-05-22 21:58:32 -0300
committerGravatar GitHub <noreply@github.com> 2023-05-22 17:58:32 -0700
commit23d42dc2377440dedc9d8e423f1ea077507d62c8 (patch)
tree8f1642a1f6d990445ff10458c735ebb49639aba8
parente869fc092f45d03aa0398613b316814a5219b762 (diff)
downloadbun-23d42dc2377440dedc9d8e423f1ea077507d62c8.tar.gz
bun-23d42dc2377440dedc9d8e423f1ea077507d62c8.tar.zst
bun-23d42dc2377440dedc9d8e423f1ea077507d62c8.zip
443 should default to https when no protocol is informed (#3008)
-rw-r--r--src/bun.js/http.exports.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bun.js/http.exports.js b/src/bun.js/http.exports.js
index 7f988b04c..c05d70d9a 100644
--- a/src/bun.js/http.exports.js
+++ b/src/bun.js/http.exports.js
@@ -1285,7 +1285,16 @@ export class ClientRequest extends OutgoingMessage {
var defaultAgent = options._defaultAgent || Agent.globalAgent;
- const protocol = (this.#protocol = options.protocol ||= defaultAgent.protocol);
+ let protocol = options.protocol;
+ if (!protocol) {
+ if (options.port === 443) {
+ protocol = "https:";
+ } else {
+ protocol = defaultAgent.protocol || "http:";
+ }
+ this.#protocol = protocol;
+ }
+
switch (this.#agent?.protocol) {
case undefined: {
break;