首页 > 代码库 > get请求长度
get请求长度
昨天把写的那篇《什么时候用GET?什么时候用POST?》给转到了phpx,结果有网友置疑,认为“GET最多不可超过255个字符”。虽说这篇文章是从著名的《PHP & MySQL Web数据库应用开发指南》上摘下来的更让我信任,本着钻研的精神我还是在网上进行了一翻考证。
还真找到了最权威的资料:
这个是微软官方的解释:http://support.microsoft.com/default.aspx?scid=kb;EN-US;q208427
长度是2083字节,路径的最大长度是2048字节, post和get都是,这已经远大于传说的256了。
下面的文章取自RFC更加的权威了http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-parameters.html
原来HTTP协议本身未指定任何对URL长度要求。它只是建议不要超过255个字符,因为有些很老的客户端或者代理只能接收小于255个字符的URL,服务器本身不限制URL的长度。但是客户端或者代理通常都会限制URL的长度,IE本身对GET请求的URL总长度限制是2048字符, 减去实际路径中的字符数就是允许参数长度,而其它几个浏览器支持得甚至更长。浏览器的版本也不必过地担心,还有几人在用IE4.0以前的“史前”版本呢?
Microsoft Internet Explorer has a maximum uniform resource locator (URL) length of 2,083 characters. 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.
However, the POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the header and not in the URL.
RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1," does not specify any requirement for URL length.
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.
However, the POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the header and not in the URL.
RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1," does not specify any requirement for URL length.
get请求长度
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。