Fix commonMain cancellation handling in HTTP server loop
This commit is contained in:
parent
01ceecd7df
commit
b969edd30a
@ -87,8 +87,8 @@ private class StartedHttpServer(
|
|||||||
withTimeout(config.keepAliveTimeoutMillis) {
|
withTimeout(config.keepAliveTimeoutMillis) {
|
||||||
parseHttpRequest(reader, config)
|
parseHttpRequest(reader, config)
|
||||||
}
|
}
|
||||||
} catch (_: CancellationException) {
|
} catch (e: CancellationException) {
|
||||||
throw CancellationException()
|
throw e
|
||||||
} catch (e: HttpProtocolException) {
|
} catch (e: HttpProtocolException) {
|
||||||
safeWriteError(socket, e.status, e.message ?: defaultReason(e.status))
|
safeWriteError(socket, e.status, e.message ?: defaultReason(e.status))
|
||||||
break
|
break
|
||||||
@ -99,8 +99,8 @@ private class StartedHttpServer(
|
|||||||
|
|
||||||
val result = try {
|
val result = try {
|
||||||
handler.handle(request)
|
handler.handle(request)
|
||||||
} catch (_: CancellationException) {
|
} catch (e: CancellationException) {
|
||||||
throw CancellationException()
|
throw e
|
||||||
} catch (_: Throwable) {
|
} catch (_: Throwable) {
|
||||||
HttpHandlerResult.Response(HttpResponse(status = 500, close = true))
|
HttpHandlerResult.Response(HttpResponse(status = 500, close = true))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user