mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
fix(node/tls): fix TLSSocket constructor (#2749)
This commit is contained in:
parent
d2cf6c88f0
commit
198fbe5707
@ -1,6 +1,7 @@
|
||||
// Copyright 2018-2022 Deno authors. All rights reserved. MIT license.
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file no-explicit-any
|
||||
|
||||
import {
|
||||
ObjectAssign,
|
||||
StringPrototypeReplace,
|
||||
@ -18,6 +19,8 @@ import {
|
||||
Pipe,
|
||||
} from "./internal_binding/pipe_wrap.ts";
|
||||
import { EventEmitter } from "./events.ts";
|
||||
import { kEmptyObject } from "./internal/util.mjs";
|
||||
|
||||
const kConnectOptions = Symbol("connect-options");
|
||||
const kIsVerified = Symbol("verified");
|
||||
const kPendingSession = Symbol("pendingSession");
|
||||
@ -63,7 +66,7 @@ export class TLSSocket extends net.Socket {
|
||||
[kConnectOptions]: any;
|
||||
ssl: any;
|
||||
_start: any;
|
||||
constructor(socket: any, opts: any) {
|
||||
constructor(socket: any, opts: any = kEmptyObject) {
|
||||
const tlsOptions = { ...opts };
|
||||
|
||||
let hostname = tlsOptions?.secureContext?.servername;
|
||||
|
@ -95,6 +95,10 @@ Deno.test("tls.createServer creates a TLS server", async () => {
|
||||
await p;
|
||||
});
|
||||
|
||||
Deno.test("TLSSocket can construct without options", () => {
|
||||
new tls.TLSSocket(new stream.PassThrough());
|
||||
});
|
||||
|
||||
Deno.test("tlssocket._handle._parentWrap is set", () => {
|
||||
// Note: This feature is used in popular 'http2-wrapper' module
|
||||
// https://github.com/szmarczak/http2-wrapper/blob/51eeaf59ff9344fb192b092241bfda8506983620/source/utils/js-stream-socket.js#L6
|
||||
|
Loading…
Reference in New Issue
Block a user