现在我有ktor服务器是基于netty的。当我对长的GET请求(大约9300个字符(主要是查询参数))执行此操作时,ktor会回答Unhandled: GET - /bad-request。如果我减少url的长度,它会工作得很好。
发布于 2019-03-14 21:58:07
在您的嵌入式服务器配置中,您可以提供一个函数“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)https://stackoverflow.com/questions/55161180
复制相似问题