首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何增加ktor可接受的url的最大长度?

如何增加ktor可接受的url的最大长度?
EN

Stack Overflow用户
提问于 2019-03-14 19:19:23
回答 1查看 497关注 0票数 0

现在我有ktor服务器是基于netty的。当我对长的GET请求(大约9300个字符(主要是查询参数))执行此操作时,ktor会回答Unhandled: GET - /bad-request。如果我减少url的长度,它会工作得很好。

EN

回答 1

Stack Overflow用户

发布于 2019-03-14 21:58:07

在您的嵌入式服务器配置中,您可以提供一个函数“HttpServerCodec”来创建HttpServerCodec (https://netty.io/4.1/api/io/netty/handler/codec/http/HttpServerCodec.html),您可以在其中设置maxInitialLineLength属性。

代码语言:javascript
复制
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)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55161180

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档