Shriram
Shriram

Reputation: 4411

difference between maxHttpHeaderSize and content-length

What is the difference between maxHttpHeaderSize in Apache tomcat server.xml and content-length in HttpServletRequest/HttpServletResponse.

    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. 

Is there any relation between these two parameters?

Upvotes: 2

Views: 6826

Answers (1)

Tom
Tom

Reputation: 1133

There is no direct connection between the two.

The content-length is a HTTP header field that specifies the length of the request body in octets (8-bit bytes). It is a general field of all HTTP requests and has no specific connection to Apache Tomcat.

The maxHttpHeaderSize field is a configuration field in Apache Tomcat configuration file - that limits the size of any HTTP header sent/received by the server (for security/or network optimization reasons I presume).

HttpServletRequest/HttpServletResponse are interfaces used to provide request information for HTTP servlets: For instance you can use it to get information of the CONTENT_LENGTH of a sent/received HTTP request.

Hope the difference is now clear. If you want to understand HTTP protocol better, start from Hypertext_Transfer_Protocol

Upvotes: 2

Related Questions