Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KTOR-4834 Fix startup message on Windows
- Loading branch information
Showing
4 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
ktor-server/ktor-server-host-common/jvm/src/io/ktor/server/engine/internal/EngineUtilsJvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package io.ktor.server.engine.internal | ||
|
||
private val OS_NAME = System.getProperty("os.name", "") | ||
.lowercase() | ||
|
||
internal actual fun escapeHostname(value: String): String { | ||
if (!OS_NAME.contains("windows")) return value | ||
if (value != "0.0.0.0") return value | ||
|
||
return "127.0.0.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...erver/ktor-server-host-common/jvmAndNix/src/io/ktor/server/engine/internal/EngineUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package io.ktor.server.engine.internal | ||
|
||
internal expect fun escapeHostname(value: String): String |
7 changes: 7 additions & 0 deletions
7
ktor-server/ktor-server-host-common/nix/src/io/ktor/server/engine/internal/EngineUtilsNix.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package io.ktor.server.engine.internal | ||
|
||
internal actual fun escapeHostname(value: String): String = value |