Skip to content

HTTP server listen fixes #2146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 7, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix 80 getting dropped from bind-addr
  • Loading branch information
code-asher committed Sep 30, 2020
commit 8b5deac92b339b621b5a6b6219180003d1c38196
5 changes: 4 additions & 1 deletion src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ export async function readConfigFile(configPath?: string): Promise<Args> {

function parseBindAddr(bindAddr: string): [string, number] {
const u = new URL(`http://${bindAddr}`)
return [u.hostname, parseInt(u.port, 10)]
// With the http scheme 80 will be dropped so assume it's 80 if missing. This
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

// means --bind-addr <addr> without a port will default to 80 as well and not
// the code-server default.
return [u.hostname, u.port ? parseInt(u.port, 10) : 80]
}

interface Addr {
Expand Down