限制Web服务器响应GET请求可以返回的数据长度 [英] Limit on the length of the data that a webserver can return in response to a GET request
问题描述
我在jetty服务器上运行 REST 服务,该服务使用某些资源数据响应 GET 请求。到目前为止,我检索的数据大约为几kb。我希望使用类似的REST服务,可能会返回大量数据,可能是100 MB或更多。由于请求量很低并且jetty服务器和其他客户端进程都配置了足够的内存,因此没有预期的内存问题。
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.
我想知道是否有jetty或任何网络服务器general会限制它可以返回给客户端以响应GET的数据长度。如果是这样,它是否可以在jetty中配置?
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?
推荐答案
对Jetty的HTTP响应返回的数据量没有限制。
There are no limits on the amount of data returned on a HTTP response from Jetty.
您可以在热死亡的宇宙。
从技术上讲,你可以拥有一个没有内容长度的HTTP响应
指定,可以使用 Chunked Transfer-Encoding 返回,或者只是带有 Connection:close
的原始字节流,通过关闭底层连接来指示数据何时完成(完成发送)。这两者基本上都是无限制的。
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.
如果您使用带有 Content-Length
标头的HTTP响应,请意识到Content-Length是, in练习,一个32位数字,但更现代的浏览器支持64位版本。
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.
这篇关于限制Web服务器响应GET请求可以返回的数据长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!