File tree Expand file tree Collapse file tree 12 files changed +72
-4
lines changed Expand file tree Collapse file tree 12 files changed +72
-4
lines changed Original file line number Diff line number Diff line change @@ -1615,7 +1615,7 @@ declare module "http" {
1615
1615
createConnection (
1616
1616
options : ClientRequestArgs ,
1617
1617
callback ?: ( err : Error | null , stream : stream . Duplex ) => void ,
1618
- ) : stream . Duplex ;
1618
+ ) : stream . Duplex | null | undefined ;
1619
1619
/**
1620
1620
* Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to:
1621
1621
*
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ declare module "https" {
32
32
class Agent extends http . Agent {
33
33
constructor ( options ?: AgentOptions ) ;
34
34
options : AgentOptions ;
35
+ createConnection (
36
+ options : RequestOptions ,
37
+ callback ?: ( err : Error | null , stream : Duplex ) => void ,
38
+ ) : Duplex | null | undefined ;
39
+ getName ( options ?: RequestOptions ) : string ;
35
40
}
36
41
interface Server <
37
42
Request extends typeof http . IncomingMessage = typeof http . IncomingMessage ,
Original file line number Diff line number Diff line change @@ -22,6 +22,18 @@ import * as url from "node:url";
22
22
23
23
agent = https . globalAgent ;
24
24
25
+ class CustomAgent extends https . Agent {
26
+ createConnection ( options : https . RequestOptions , callback ?: ( err : Error | null , socket : net . Socket ) => void ) {
27
+ const socket = new net . Socket ( options ) ;
28
+ callback ?.( null , socket ) ;
29
+ return socket ;
30
+ }
31
+ getName ( options : https . RequestOptions ) {
32
+ return `${ super . getName ( options ) } :${ options ?. ca } :${ options ?. cert } :${ options ?. key } ` ;
33
+ }
34
+ }
35
+ agent = new CustomAgent ( ) ;
36
+
25
37
let sockets : NodeJS . ReadOnlyDict < net . Socket [ ] > = agent . sockets ;
26
38
sockets = agent . freeSockets ;
27
39
Original file line number Diff line number Diff line change @@ -1559,7 +1559,7 @@ declare module "http" {
1559
1559
createConnection (
1560
1560
options : ClientRequestArgs ,
1561
1561
callback ?: ( err : Error | null , stream : stream . Duplex ) => void ,
1562
- ) : stream . Duplex ;
1562
+ ) : stream . Duplex | null | undefined ;
1563
1563
/**
1564
1564
* Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to:
1565
1565
*
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ declare module "https" {
31
31
class Agent extends http . Agent {
32
32
constructor ( options ?: AgentOptions ) ;
33
33
options : AgentOptions ;
34
+ createConnection (
35
+ options : RequestOptions ,
36
+ callback ?: ( err : Error | null , stream : Duplex ) => void ,
37
+ ) : Duplex | null | undefined ;
38
+ getName ( options ?: RequestOptions ) : string ;
34
39
}
35
40
interface Server <
36
41
Request extends typeof http . IncomingMessage = typeof http . IncomingMessage ,
Original file line number Diff line number Diff line change @@ -19,6 +19,18 @@ import * as url from "node:url";
19
19
20
20
agent = https . globalAgent ;
21
21
22
+ class CustomAgent extends https . Agent {
23
+ createConnection ( options : https . RequestOptions , callback ?: ( err : Error | null , socket : net . Socket ) => void ) {
24
+ const socket = new net . Socket ( options ) ;
25
+ callback ?.( null , socket ) ;
26
+ return socket ;
27
+ }
28
+ getName ( options : https . RequestOptions ) {
29
+ return `${ super . getName ( options ) } :${ options ?. ca } :${ options ?. cert } :${ options ?. key } ` ;
30
+ }
31
+ }
32
+ agent = new CustomAgent ( ) ;
33
+
22
34
let sockets : NodeJS . ReadOnlyDict < net . Socket [ ] > = agent . sockets ;
23
35
sockets = agent . freeSockets ;
24
36
Original file line number Diff line number Diff line change @@ -1589,7 +1589,7 @@ declare module "http" {
1589
1589
createConnection (
1590
1590
options : ClientRequestArgs ,
1591
1591
callback ?: ( err : Error | null , stream : stream . Duplex ) => void ,
1592
- ) : stream . Duplex ;
1592
+ ) : stream . Duplex | null | undefined ;
1593
1593
/**
1594
1594
* Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to:
1595
1595
*
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ declare module "https" {
31
31
class Agent extends http . Agent {
32
32
constructor ( options ?: AgentOptions ) ;
33
33
options : AgentOptions ;
34
+ createConnection (
35
+ options : RequestOptions ,
36
+ callback ?: ( err : Error | null , stream : Duplex ) => void ,
37
+ ) : Duplex | null | undefined ;
38
+ getName ( options ?: RequestOptions ) : string ;
34
39
}
35
40
interface Server <
36
41
Request extends typeof http . IncomingMessage = typeof http . IncomingMessage ,
Original file line number Diff line number Diff line change @@ -19,6 +19,18 @@ import * as url from "node:url";
19
19
20
20
agent = https . globalAgent ;
21
21
22
+ class CustomAgent extends https . Agent {
23
+ createConnection ( options : https . RequestOptions , callback ?: ( err : Error | null , socket : net . Socket ) => void ) {
24
+ const socket = new net . Socket ( options ) ;
25
+ callback ?.( null , socket ) ;
26
+ return socket ;
27
+ }
28
+ getName ( options : https . RequestOptions ) {
29
+ return `${ super . getName ( options ) } :${ options ?. ca } :${ options ?. cert } :${ options ?. key } ` ;
30
+ }
31
+ }
32
+ agent = new CustomAgent ( ) ;
33
+
22
34
let sockets : NodeJS . ReadOnlyDict < net . Socket [ ] > = agent . sockets ;
23
35
sockets = agent . freeSockets ;
24
36
Original file line number Diff line number Diff line change @@ -1591,7 +1591,7 @@ declare module "http" {
1591
1591
createConnection (
1592
1592
options : ClientRequestArgs ,
1593
1593
callback ?: ( err : Error | null , stream : stream . Duplex ) => void ,
1594
- ) : stream . Duplex ;
1594
+ ) : stream . Duplex | null | undefined ;
1595
1595
/**
1596
1596
* Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to:
1597
1597
*
You can’t perform that action at this time.
0 commit comments