HTTP POST 可以无限吗?

发布于 2024-09-02 13:03:48 字数 40 浏览 2 评论 0 原文

使用 HTTP POST 方法可以发送的最大数据大小的规范是多少?

What is the specification for maximum data size one can send with HTTP POST method?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

笔芯 2024-09-09 13:03:48

令人惊讶的是,所有答案都在谈论 IIS,就好像它是唯一重要的 Web 服务器一样。即使早在 2010 年提出这个问题时,Apache 就已经在 60%70% 的市场份额 。无论如何,

  • HTTP 协议并没有规定限制。
  • POST 方法允许发送比 GET 方法多得多的数据,后者受到 URL 长度 - 大约 2KB。
  • 最大 POST 请求正文大小在HTTP 服务器,通常范围为
    1MB 到 2GB
  • HTTP 客户端(浏览器或其他用户代理)可能有其自身的限制。因此,最大 POST 正文请求大小为 min(serverMaximumSize, clientMaximumSize)

以下是一些更流行的 HTTP 服务器的 POST 正文大小:

  • Nginx (1MB,没有实际最大值(2**63)
  • Apache - 最大 2GB,无默认记录的
  • IIS - 默认28.6MB为请求长度,2048字节为查询字符串;最大未记录的
  • InfluxDB - 默认 ~25MB,最大无证记录

Quite amazing how all answers talk about IIS, as if that were the only web server that mattered. Even back in 2010 when the question was asked, Apache had between 60% and 70% of the market share. Anyway,

  • The HTTP protocol does not specify a limit.
  • The POST method allows sending far more data than the GET method, which is limited by the URL length - about 2KB.
  • The maximum POST request body size is configured on the HTTP server and typically ranges from
    1MB to 2GB
  • The HTTP client (browser or other user agent) can have its own limitations. Therefore, the maximum POST body request size is min(serverMaximumSize, clientMaximumSize).

Here are the POST body sizes for some of the more popular HTTP servers:

明月松间行 2024-09-09 13:03:48

编辑(2019)这个答案现在相当多余,但有

这取决于网络服务器和网络浏览器:

Internet explorer 所有版本 2GB-1
Mozilla Firefox 所有版本 2GB-1
IIS 1-5 2GB-1
IIS 6 4GB-1

虽然 IIS 默认情况下仅支持 200KB,但需要修改元数据库来增加此大小。

http://www.motobit.com/help/scptutl/pa98.htm

POST 方法本身对数据大小没有任何限制。

EDIT (2019) This answer is now pretty redundant but there is another answer with more relevant information.

It rather depends on the web server and web browser:

Internet explorer All versions 2GB-1
Mozilla Firefox All versions 2GB-1
IIS 1-5 2GB-1
IIS 6 4GB-1

Although IIS only support 200KB by default, the metabase needs amending to increase this.

http://www.motobit.com/help/scptutl/pa98.htm

The POST method itself does not have any limit on the size of data.

好多鱼好多余 2024-09-09 13:03:48

根据 HTTP 协议本身没有限制,但实现会有一个实际的上限。我曾使用 POST 向 Apache 发送超过 4 GB 的数据,但当时某些服务器确实有 4 GB 的限制。

There is no limit according to the HTTP protocol itself, but implementations will have a practical upper limit. I have sent data exceeding 4 GB using POST to Apache, but some servers did have a limit of 4 GB at the time.

迷爱 2024-09-09 13:03:48

POST 允许将任意长度的数据发送到服务器,但存在基于超时/带宽等的限制。

我认为基本上,更安全的做法是假设发送大量数据是可以的。

POST allows for an arbitrary length of data to be sent to a server, but there are limitations based on timeouts/bandwidth etc.

I think basically, it's safer to assume that it's not okay to send lots of data.

抚你发端 2024-09-09 13:03:48

根据这篇(现已删除)文章,不同的 IIS Web 服务器可以处理“标头”中不同数量的数据; http://classicasp .aspfaq.com/forms/what-is-the-limit-on-form/post-parameters.html

请注意,没有限制
您可以传递的 FORM 元素的数量
通过 POST,但仅限于聚合
所有名称/值对的大小。尽管
GET 限制为低至 1024
个字符,POST 数据限制为 2 个
IIS 4.0 上为 MB,IIS 5.0 上为 128 KB。
每个名称/值限制为 1024
SGML 规定的字符
规格当然这不适用于
使用上传的文件
enctype='multipart/form-data' ...我
上传文件没有问题
使用 IIS 在 90 - 100 MB 范围内
5.0,除了必须增加 server.scriptTimeout 值以及
我的耐心!

Different IIS web servers can process different amounts of data in the 'header', according to this (now deleted) article; http://classicasp.aspfaq.com/forms/what-is-the-limit-on-form/post-parameters.html;

Note that there is no limit on the
number of FORM elements you can pass
via POST, but only on the aggregate
size of all name/value pairs. While
GET is limited to as low as 1024
characters, POST data is limited to 2
MB on IIS 4.0, and 128 KB on IIS 5.0.
Each name/value is limited to 1024
characters, as imposed by the SGML
spec. Of course this does not apply to
files uploaded using
enctype='multipart/form-data' ... I
have had no problems uploading files
in the 90 - 100 MB range using IIS
5.0, aside from having to increase the server.scriptTimeout value as well as
my patience!

渔村楼浪 2024-09-09 13:03:48

在我正在开发的一个应用程序中,我遇到了大约 2KB 的 POST 限制。事实证明,我不小心将参数编码到 URL 中,而不是在正文中传递它们。因此,如果您在那里遇到问题,那么您可以发送编码到 URL 中的 POST 数据的大小肯定有一个非常小的限制。

In an application I was developing I ran into what appeared to be a POST limit of about 2KB. It turned out to be that I was accidentally encoding the parameters into the URL instead of passing them in the body. So if you're running into a problem there, there is definitely a very small limit on the size of POST data you can send encoded into the URL.

青萝楚歌 2024-09-09 13:03:48

HTTP 可能没有上限,但网络服务器可能有上限。在 ASP.NET 中,默认接受限制为 4 MB,但您(开发人员/网站管理员)可以将其更改为更高或更低。

HTTP may not have an upper limit, but webservers may have one. In ASP.NET there is a default accept-limit of 4 MB, but you (the developer/webmaster) can change that to be higher or lower.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文