question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

addr defaults to "0.0.0.0"

See original GitHub issue

Describe the bug In server.ts, the function serve() unconditionally returns addr “0.0.0.0” This is incorrect for Windows and shows up in many Deno code examples and libs.

Expected behavior Should return “127.0.0.1” on Windows

OS: Windows 10

Additional context

deno_std/http/server.ts line# 265

export function _parseAddrFromStr(addr: string): HTTPOptions {
  let url: URL;
  try {
    //HACK add this line to return a correct default addr
    const defaultAddr = (Deno.build.os === "windows") ? "127.0.0.1" : "0.0.0.0";
    const host = addr.startsWith(":") ? `${defaultAddr}${addr}` : addr;
    url = new URL(`http://${host}`);
  }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nhronescommented, Sep 6, 2021

@kt3k I would agree that the problem is actually the logged messages in many downstream apps/libs. I’ve recently seen many of them corrected to log ‘http://localhost:xxxx’. Perhaps a lint to suggest localhost this would help. Since I opened this issue, should I close it here?

0reactions
treysiscommented, Apr 25, 2022

Keep in mind that on many systems, including Windows, localhost also resolves to ::1. Right now, I only know of Ubuntu that doesn’t resolve localhost to ::1, but instead uses ip6-localhost.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does the 0.0.0.0 IP address mean and why is it used?
One of a few special-purpose addresses, IP address 0.0.0.0 has several applications in networking. It stands in as a placeholder address, identifies a...
Read more >
0.0.0.0 - Wikipedia
It is commonly used in routing to depict the default route as a destination subnet. It matches all addresses in the IPv4 address...
Read more >
What Does The IP Address 0.0.0.0 Really Mean? What Are ...
The IP address 0.0.0.0 signifies different uses at different places. ... In route entry's context, it usually means the default route.
Read more >
2 - Network Engineering Stack Exchange
Every IPv4 address is in the 0.0.0.0/0 network, so every address would match that network in a routing table, which is why it...
Read more >
What It Means When You See The 0.0.0.0 IP Address - Huawei
0.0 when they are not connected to a TCP/IP network. A device may default to this address when they are offline. It can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found