【发布时间】:2019-08-05 06:27:06
【问题描述】:
现在我的 ktor 服务器是基于 netty 的。
当我执行长 GET 请求(大约 9300 个字符(主要在查询参数中))时,ktor 回答 Unhandled: GET - /bad-request。
如果我减少 url 的长度,它工作正常。
【问题讨论】:
现在我的 ktor 服务器是基于 netty 的。
当我执行长 GET 请求(大约 9300 个字符(主要在查询参数中))时,ktor 回答 Unhandled: GET - /bad-request。
如果我减少 url 的长度,它工作正常。
【问题讨论】:
在您的嵌入式服务器配置中,您可以提供一个函数“httpServerCodec”来创建 HttpServerCodec (https://netty.io/4.1/api/io/netty/handler/codec/http/HttpServerCodec.html),您可以在其中设置 maxInitialLineLength 属性。
embeddedServer(Netty, configure = {
// Size of the queue to store [ApplicationCall] instances that cannot be immediately processed
requestQueueLimit = 16
// Do not create separate call event group and reuse worker group for processing calls
shareWorkGroup = false
// User-provided function to configure Netty's [ServerBootstrap]
configureBootstrap = {
// ...
}
httpServerCodec = {
HttpServerCodec(.......)
}
// Timeout in seconds for sending responses to client
responseWriteTimeoutSeconds = 10
}) {
// ...
}.start(true)
【讨论】: