aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;