Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit on the length of the data that a webserver can return in response to a GET request

I have a REST service running on jetty server that responds to GET requests with some resource data. So far the data that i retrieve has been in the order of a few kb. I am looking to use a similar REST service that could possibly return huge data, may be a 100 mb or more. No memory issues expected since the request volume is low and both the jetty server and rest client processes have been configured with enough memory.

I am wondering if jetty or any webserver in general places a restriction on the length of data it can return to the client in response to a GET. If so, is it configurable in jetty?

like image 808
techuser soma Avatar asked Apr 23 '13 14:04

techuser soma


People also ask

What is the max length of a GET request?

Internet Explorer also has a maximum path length of 2,048 characters. This limit applies to both POST request and GET request URLs. If you are using the GET method, you are limited to a maximum of 2,048 characters, minus the number of characters in the actual path.

Is there a limit to the size of an HTTP response?

The response limit is 9,223,372,036,854,775,807 bytes (2 ** 64).

Is there a limit on HTTP request?

The default value of the HTTP and HTTPS connector maximum post size is 2MB. However you can adjust the value as per your requirement. The below command to set the connector to accept maximum 100,000 bytes. If the http request POST size exceeds the 100,000 bytes then connector return HTTP/1.1 400 Bad Request.

What is the limitation of GET method?

Disadvantages of GET GET can't be used to send word documents or images. GET requests can be used only to retrieve data. The GET method cannot be used for passing sensitive information like usernames and passwords. The length of the URL is limited. If you use GET method, the browser appends the data to the URL.


1 Answers

Original Answer:

There are no limits on the amount of data returned on a HTTP response from Jetty.

You could stream data back to the client until shortly before the heat death of the universe.

Technically speaking, you can have a HTTP Response with no Content-Length specified, which can be returned using either the Chunked Transfer-Encoding, or just a raw stream of bytes with a Connection: close indicating when the data is complete (done being sent) by a close of the underlying connection. Both of which are essentially limit-less.

If you use a HTTP Response with Content-Length header, be aware that Content-Length is, in practice, a 32-bit number, but more modern browsers support the 64-bit versions.

Update (August 2019):

Jetty 9.4.20.v20190813 can now handle Content-Length headers of maximum size Long.MAX_VALUE (9,223,372,036,854,775,807 bytes)

like image 105
Joakim Erdfelt Avatar answered Sep 24 '22 15:09

Joakim Erdfelt