1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-05 13:59:01 -05:00

avoid startTls workaround

This commit is contained in:
Yoshiya Hinosawa 2024-10-25 17:06:01 +09:00
parent 2b2d9d9be2
commit 8e55dab349
No known key found for this signature in database
GPG key ID: 9017DB4559488785
3 changed files with 5 additions and 10 deletions

View file

@ -151,13 +151,6 @@ export class TLSSocket extends net.Socket {
// Patches `afterConnect` hook to replace TCP conn with TLS conn
const afterConnect = handle.afterConnect;
handle.afterConnect = async (req: any, status: number) => {
if (tlssock._isNpmAgent) {
// skips the TLS handshake for @npmcli/agent as it's handled by
// onSocket handler of ClientRequest object.
tlssock.emit("secure");
tlssock.removeListener("end", onConnectEnd);
return afterConnect.call(handle, req, status);
}
try {
const conn = await Deno.startTls(handle[kStreamBaseField], options);
try {

View file

@ -451,7 +451,7 @@ class ClientRequest extends OutgoingMessage {
try {
const parsedUrl = new URL(url);
let baseConnRid = this.socket.rid;
if (this._encrypted) {
if (this._encrypted && !this.socket.authorized) {
[baseConnRid] = op_tls_start({
rid: this.socket.rid,
hostname: parsedUrl.hostname,

View file

@ -87,7 +87,6 @@ export enum constants {
}
export class TCP extends ConnectionWrap {
rid: number;
[ownerSymbol]: unknown = null;
override reading = false;
@ -259,6 +258,10 @@ export class TCP extends ConnectionWrap {
}
}
get rid() {
return this[kStreamBaseField][internalRidSymbol];
}
/**
* Populates the provided object with local address entries.
* @param sockname An object to add the local address entries to.
@ -386,7 +389,6 @@ export class TCP extends ConnectionWrap {
this.#address = req.localAddress = localAddr.hostname;
this.#port = req.localPort = localAddr.port;
this[kStreamBaseField] = conn;
this.rid = conn[internalRidSymbol];
try {
this.afterConnect(req, 0);