HTTP POST 可以无限吗?
使用 HTTP POST 方法可以发送的最大数据大小的规范是多少?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
使用 HTTP POST 方法可以发送的最大数据大小的规范是多少?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
令人惊讶的是,所有答案都在谈论 IIS,就好像它是唯一重要的 Web 服务器一样。即使早在 2010 年提出这个问题时,Apache 就已经在 60% 和 70% 的市场份额 。无论如何,
1MB 到 2GB
min(serverMaximumSize, clientMaximumSize)
。以下是一些更流行的 HTTP 服务器的 POST 正文大小:
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,
1MB to 2GB
min(serverMaximumSize, clientMaximumSize)
.Here are the POST body sizes for some of the more popular HTTP servers:
编辑(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.
根据 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.
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.
根据这篇(现已删除)文章,不同的 IIS Web 服务器可以处理“标头”中不同数量的数据;
http://classicasp .aspfaq.com/forms/what-is-the-limit-on-form/post-parameters.html;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;在我正在开发的一个应用程序中,我遇到了大约 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.
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.