简体   繁体   English

如何使用Netty获取HTTP请求/响应头的大小?

[英]How to get the size of http request/response header using Netty?

In my use case I would like to get the size of the http header in bytes using Netty . 在我的用例中,我想使用Netty获取http标头的大小(以字节为单位)。 I went through the source code of Netty. 我浏览了Netty的源代码。 By default the header size is 8KiB [8192 bytes]. 默认情况下,标头大小为8KiB [8192字节]。 It ignores the remaining headers ( decoder ). 它忽略其余的标头( 解码器 )。 But Netty does not provide a function to get the current header size. 但是Netty没有提供获取当前标头大小的功能。

Is there a function to get the size of the header using Netty? 是否有使用Netty获取标头大小的函数? If not, what is the best way get the header size from the http request? 如果不是,从http请求中获取标头大小的最佳方法是什么? Could someone help me with this? 有人可以帮我吗?

An HTTP header block consists of a variable number of lines of variable length, and the block is terminated by a blank line. HTTP标头块由可变长度的可变数量的行组成,并且该块以空白行终止。 It doesn't have a predefined size, or a size that is available via any API I am aware of. 它没有预定义的大小,也没有可通过任何我知道的API使用的大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM