addr defaults to "0.0.0.0"
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:14 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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?
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 usesip6-localhost
.