summaryrefslogtreecommitdiff
path: root/ext/http/00_serve.ts
diff options
context:
space:
mode:
authorYazan AbdAl-Rahman <yazan.abdalrahman@exalt.ps>2024-07-29 00:04:05 +0300
committerGitHub <noreply@github.com>2024-07-28 23:04:05 +0200
commit41f8988dc7f7e307af28af52e6d89469c824f214 (patch)
tree6f4623efb0111e6beae102ccb12b87e38d21b252 /ext/http/00_serve.ts
parent50fa4d7ef5d0615d60042eda72e34adb773e2ecf (diff)
fix(http): Adjust hostname display for Windows when using 0.0.0.0 (#24698)
Fixes #24687 --------- Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Diffstat (limited to 'ext/http/00_serve.ts')
-rw-r--r--ext/http/00_serve.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/http/00_serve.ts b/ext/http/00_serve.ts
index 670b64676..a58d19d76 100644
--- a/ext/http/00_serve.ts
+++ b/ext/http/00_serve.ts
@@ -657,7 +657,8 @@ function serve(arg1, arg2) {
// If the hostname is "0.0.0.0", we display "localhost" in console
// because browsers in Windows don't resolve "0.0.0.0".
// See the discussion in https://github.com/denoland/deno_std/issues/1165
- const hostname = addr.hostname == "0.0.0.0" || addr.hostname == "::"
+ const hostname = (addr.hostname == "0.0.0.0" || addr.hostname == "::") &&
+ (Deno.build.os === "windows")
? "localhost"
: addr.hostname;
addr.hostname = hostname;