Не подтверждена Коммит d300441c создал по автору Leonid Stashevsky's avatar Leonid Stashevsky Зафиксировано автором GitHub
Просмотр файлов

KTOR-4834 Fix startup message on Windows (#3157)

* KTOR-4834 Fix startup message on Windows
владелец 3b31017b
......@@ -43,7 +43,7 @@ class CookiesTest {
}
@Test
fun testCookiesAreRenderedWithSpaceInBetween() = testSuspend{
fun testCookiesAreRenderedWithSpaceInBetween() = testSuspend {
var storage = AcceptAllCookiesStorage()
storage.addCookie("http://localhost/", Cookie("name1", "value1"))
storage.addCookie("http://localhost/", Cookie("name2", "value2"))
......
......@@ -402,8 +402,6 @@ class ContentNegotiationTests {
}
}
object Thing
data class StringWrapper(val value: String)
......
/*
* 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"
}
......@@ -72,8 +72,9 @@ public abstract class BaseApplicationEngine(
val log = environment.log
CoroutineScope(environment.application.coroutineContext).launch {
connectors.await().forEach {
val host = escapeHostname(it.host)
log.info(
"Responding at ${it.type.name.lowercase()}://${it.host}:${it.port}"
"Responding at ${it.type.name.lowercase()}://$host:${it.port}"
)
}
}
......
/*
* 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
/*
* 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
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать