Is URL a part of request size?

2019-08-26 11:17发布

问题:

Just wondering if URL, what can be very big (source), is counted as part of HTTP request size, since its values are send to server (specially with query string)?

回答1:

Yes, the target of the request is part of the message sent to the server:

GET /hello.txt HTTP/1.1
Host: example.com
Accept: text/plain

From the RFC 7230, which defines the message syntax and routing of the HTTP/1.1 protocol:

3.1.1. Request Line

A request-line begins with a method token, followed by a single space (SP), the request-target, another single space (SP), the protocol version, and ends with CRLF. [...]

HTTP does not place a predefined limit on the length of a request-line [...]

A server that receives a request-target longer than any URI it wishes to parse MUST respond with a 414 (URI Too Long) status code [...]

Various ad hoc limitations on request-line length are found in practice. It is RECOMMENDED that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets.