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.
这两个参数之间有什么关系吗?
两者之间没有直接联系。
content-length是一个HTTP报头字段,以8位字节为单位指定请求正文的长度。它是所有HTTP请求的通用字段,与Apache Tomcat没有特定的连接。
maxHttpHeaderSize字段是Apache Tomcat配置文件中的一个配置字段-它限制了服务器发送/接收的任何HTTP头的大小(出于安全/或网络优化原因)。
HttpServletRequest/HttpServletResponse是为HTTP servlet提供请求信息的接口:例如,您可以使用它来获取发送/接收HTTP请求的CONTENT_LENGTH信息。希望现在差别清楚了。如果你想更好地理解HTTP协议,从Hypertext_Transfer_Protocol