File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,11 @@ export function connect(
1010 options ?: SocketOptions ,
1111) : Socket {
1212 if ( typeof address === 'string' ) {
13- const url = new URL ( address ) ;
13+ const url = new URL ( `https:// ${ address } ` ) ;
1414 // eslint-disable-next-line no-param-reassign -- there is no harm reassigning to this param
1515 address = {
1616 hostname : url . hostname ,
17- port : parseInt ( url . port ) ,
17+ port : parseInt ( url . port === '' ? '443' : url . port ) ,
1818 } ;
1919 }
2020 return new Socket ( address , options ) ;
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ void tap.test(
7979
8080 const address = await listenAndGetSocketAddress ( server ) ;
8181
82- const socket = connect ( `tcp:// localhost:${ address . port } ` ) ;
82+ const socket = connect ( `localhost:${ address . port } ` ) ;
8383
8484 const writer = socket . writable . getWriter ( ) ;
8585 await t . resolves ( writer . write ( message ) ) ;
@@ -89,6 +89,11 @@ void tap.test(
8989 } ,
9090) ;
9191
92+ void tap . test ( 'connect on port 443 works' , async ( t ) => {
93+ const socket = connect ( `github.com:443` ) ;
94+ await t . resolves ( socket . close ( ) ) ;
95+ } ) ;
96+
9297for ( const data of [
9398 new Uint8Array ( [ 0 , 1 , 2 ] ) ,
9499 new Uint16Array ( [ 0 , 1 , 2 ] ) ,
@@ -117,7 +122,7 @@ for (const data of [
117122
118123 const address = await listenAndGetSocketAddress ( server ) ;
119124
120- const socket = connect ( `tcp:// localhost:${ address . port } ` ) ;
125+ const socket = connect ( `localhost:${ address . port } ` ) ;
121126 const { reader, writer } = getReaderWriterFromSocket ( socket ) ;
122127
123128 await t . resolves ( writer . write ( message ) ) ;
You can’t perform that action at this time.
0 commit comments