Apache tomcat server.xml 中的 maxHttpHeaderSize 和 HttpServletRequest/HttpServletResponse 中的 content-length 有什么区别。
maxHttpHeaderSize - The maximum size of the request and response HTTP header, specified in bytes. If not specified, this attribute is set to 4096 (4 KB).
content-Length -The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
这两个参数之间有什么关系吗?
最佳答案
两者之间没有直接联系。
内容长度是 HTTP header field指定请求正文的长度(以八位字节(8 位字节)为单位)。它是所有HTTP请求的通用字段,与Apache Tomcat没有特定的联系。
maxHttpHeaderSize 字段是 Apache Tomcat 配置文件中的一个配置字段 - 它限制服务器发送/接收的任何 HTTP header 的大小(我认为是出于安全/或网络优化原因)。
HttpServletRequest/HttpServletResponse 是用于为 HTTP servlet 提供请求信息的接口(interface): 例如,您可以使用它来获取发送/接收的 HTTP 请求的 CONTENT_LENGTH 信息。
希望现在差异已经很明显了。 如果你想更好地了解HTTP协议(protocol),请从Hypertext_Transfer_Protocol开始
关于java - maxHttpHeaderSize 和 content-length 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31290787/