File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -401,7 +401,10 @@ export async function readConfigFile(configPath?: string): Promise<Args> {
401401
402402function parseBindAddr ( bindAddr : string ) : [ string , number ] {
403403 const u = new URL ( `http://${ bindAddr } ` )
404- return [ u . hostname , parseInt ( u . port , 10 ) ]
404+ // With the http scheme 80 will be dropped so assume it's 80 if missing. This
405+ // means --bind-addr <addr> without a port will default to 80 as well and not
406+ // the code-server default.
407+ return [ u . hostname , u . port ? parseInt ( u . port , 10 ) : 80 ]
405408}
406409
407410interface Addr {
Original file line number Diff line number Diff line change @@ -584,8 +584,11 @@ export class HttpServer {
584584 const onListen = ( ) : void => resolve ( this . address ( ) )
585585 if ( this . options . socket ) {
586586 this . server . listen ( this . options . socket , onListen )
587+ } else if ( this . options . host ) {
588+ // [] is the correct format when using :: but Node errors with them.
589+ this . server . listen ( this . options . port , this . options . host . replace ( / ^ \[ | \] $ / g, "" ) , onListen )
587590 } else {
588- this . server . listen ( this . options . port , this . options . host , onListen )
591+ this . server . listen ( this . options . port , onListen )
589592 }
590593 } )
591594 }
You can’t perform that action at this time.
0 commit comments