mirror of
https://github.com/denoland/deno.git
synced 2025-01-08 07:08:27 -05:00
avoid startTls workaround
This commit is contained in:
parent
2b2d9d9be2
commit
8e55dab349
3 changed files with 5 additions and 10 deletions
|
@ -151,13 +151,6 @@ export class TLSSocket extends net.Socket {
|
||||||
// Patches `afterConnect` hook to replace TCP conn with TLS conn
|
// Patches `afterConnect` hook to replace TCP conn with TLS conn
|
||||||
const afterConnect = handle.afterConnect;
|
const afterConnect = handle.afterConnect;
|
||||||
handle.afterConnect = async (req: any, status: number) => {
|
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 {
|
try {
|
||||||
const conn = await Deno.startTls(handle[kStreamBaseField], options);
|
const conn = await Deno.startTls(handle[kStreamBaseField], options);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -451,7 +451,7 @@ class ClientRequest extends OutgoingMessage {
|
||||||
try {
|
try {
|
||||||
const parsedUrl = new URL(url);
|
const parsedUrl = new URL(url);
|
||||||
let baseConnRid = this.socket.rid;
|
let baseConnRid = this.socket.rid;
|
||||||
if (this._encrypted) {
|
if (this._encrypted && !this.socket.authorized) {
|
||||||
[baseConnRid] = op_tls_start({
|
[baseConnRid] = op_tls_start({
|
||||||
rid: this.socket.rid,
|
rid: this.socket.rid,
|
||||||
hostname: parsedUrl.hostname,
|
hostname: parsedUrl.hostname,
|
||||||
|
|
|
@ -87,7 +87,6 @@ export enum constants {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TCP extends ConnectionWrap {
|
export class TCP extends ConnectionWrap {
|
||||||
rid: number;
|
|
||||||
[ownerSymbol]: unknown = null;
|
[ownerSymbol]: unknown = null;
|
||||||
override reading = false;
|
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.
|
* Populates the provided object with local address entries.
|
||||||
* @param sockname An object to add the local address entries to.
|
* @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.#address = req.localAddress = localAddr.hostname;
|
||||||
this.#port = req.localPort = localAddr.port;
|
this.#port = req.localPort = localAddr.port;
|
||||||
this[kStreamBaseField] = conn;
|
this[kStreamBaseField] = conn;
|
||||||
this.rid = conn[internalRidSymbol];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.afterConnect(req, 0);
|
this.afterConnect(req, 0);
|
||||||
|
|
Loading…
Reference in a new issue