Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node:tls's connect method has a bug processing args #16086

Open
yume-chan opened this issue Dec 31, 2024 · 0 comments
Open

node:tls's connect method has a bug processing args #16086

yume-chan opened this issue Dec 31, 2024 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@yume-chan
Copy link

What version of Bun is running?

1.1.42+50eec0025

What platform is your computer?

Microsoft Windows NT 10.0.27764.0 x64

What steps can reproduce the bug?

import { connect } from "node:tls";

const a = connect(24800, "localhost", { rejectUnauthorized: false });
// @ts-ignore
console.log(a._rejectUnauthorized);

const b = connect({
  port: 24800,
  host: "localhost",
  rejectUnauthorized: false,
});
// @ts-ignore
console.log(b._rejectUnauthorized);

What is the expected behavior?

Both to be false

What do you see instead?

> bun src/test.ts
true
false
DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate

Bun v1.1.42 (Windows x64)

Additional information

The connect method throws away the options parameter when first parameter is not an object:

bun/src/js/node/tls.ts

Lines 685 to 695 in 37e7f5b

function connect(...args) {
if (typeof args[0] !== "object") {
return new TLSSocket().connect(...args);
}
let [options, callback] = normalizeConnectArgs(args);
const { ALPNProtocols } = options;
if (ALPNProtocols) {
convertALPNProtocols(ALPNProtocols, options);
}
return new TLSSocket(options).connect(options, callback);
}

Line 686-688 should be straightly deleted.

@yume-chan yume-chan added bug Something isn't working needs triage labels Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant