Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The maximum length of HTTP Start-Line

Tags:

http

Does HTTP limit the length of Start-Line(Request-Line or Status-Line)?

If it does, Which status-code HTTP Server should response when received a HTTP request whose Request-Line is longer than the maximum length?

like image 682
npcode Avatar asked Jan 20 '26 09:01

npcode


1 Answers

Quoting from THE HTTP 1.1 RFC(2616),

The Request-Line begins with a method token, followed by the Request-URI and the protocol version, and ending with CRLF. The elements are separated by SP characters. No CR or LF is allowed except in the final CRLF sequence.

   Request-Line   = Method SP Request-URI SP HTTP-Version CRLF

This does not specify a limit on the length.

The Request-URI can itself be long, and the rfc also says about that:

The HTTP protocol does not place any a priori limit on the length of a URI. Servers MUST be able to handle the URI of any resource they serve, and SHOULD be able to handle URIs of unbounded length if they provide GET-based forms that could generate such URIs. A server SHOULD return 414 (Request-URI Too Long) status if a URI is longer than the server can handle (see section 10.4.15).

So a "too long" status exists for Request-URI, but it means "too long for this server to handle" and not "longer than the spec allows."

like image 199
Don Roby Avatar answered Jan 22 '26 23:01

Don Roby



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!