File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1248,6 +1248,7 @@ exports.connect = function connect(...args) {
1248
1248
host : options . host ,
1249
1249
family : options . family ,
1250
1250
localAddress : options . localAddress ,
1251
+ localPort : options . localPort ,
1251
1252
lookup : options . lookup
1252
1253
} ;
1253
1254
socket . connect ( connectOpt , socket . _start ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ const common = require ( '../common' ) ;
3
+ const fixtures = require ( '../common/fixtures' ) ;
4
+
5
+ if ( ! common . hasCrypto )
6
+ common . skip ( 'missing crypto' ) ;
7
+
8
+ const https = require ( 'https' ) ;
9
+ const assert = require ( 'assert' ) ;
10
+
11
+ {
12
+ https . createServer ( {
13
+ cert : fixtures . readKey ( 'agent1-cert.pem' ) ,
14
+ key : fixtures . readKey ( 'agent1-key.pem' ) ,
15
+ } , common . mustCall ( function ( req , res ) {
16
+ this . close ( ) ;
17
+ res . end ( ) ;
18
+ } ) ) . listen ( 0 , common . localhostIPv4 , common . mustCall ( function ( ) {
19
+ const port = this . address ( ) . port ;
20
+ const req = https . get ( {
21
+ host : common . localhostIPv4 ,
22
+ pathname : '/' ,
23
+ port,
24
+ family : 4 ,
25
+ localPort : 34567 ,
26
+ rejectUnauthorized : false
27
+ } , common . mustCall ( ( ) => {
28
+ assert . strictEqual ( req . socket . localPort , 34567 ) ;
29
+ assert . strictEqual ( req . socket . remotePort , port ) ;
30
+ } ) ) ;
31
+ } ) ) ;
32
+ }
You can’t perform that action at this time.
0 commit comments