大家好,又见面了,我是你们的朋友全栈君。
http 1.1 协议中对url的长度是不受限制的,协议原文:
// https://www.ietf.org/rfc/rfc2616.txt
3.2.1 General Syntax
The HTTP protocol does not place any a priori limit on the length of
a URI. Servers MUST be able to handle the URI of any resource they
serve, and SHOULD be able to handle URIs of unbounded length if they
provide GET-based forms that could generate such URIs. A server
SHOULD return 414 (Request-URI Too Long) status if a URI is longer
than the server can handle (see section 10.4.15).
Note: Servers ought to be cautious about depending on URI lengths
above 255 bytes, because some older client or proxy
implementations might not properly support these lengths.
翻译:
HTTP协议不对URI的长度作事先的限制,服务器必须能够处理任何他们提供资源的URI,并且应该能够处理无限长度的URIs,这种无效长度的URL可能会在客户端以基于GET方式的请求时产生。如果服务器不能处理太长的URI的时候,服务器应该返回414状态码(此状态码代表Request-URI太长)。
注:服务器在依赖大于255字节的URI时应谨慎,因为一些旧的客户或代理实现可能不支持这些长度。
协议中未明确对url进行长度限制,但在真正实现中,url的长度还是受到限制的,一是服务器端的限制,二就是浏览器端的限制。
服务器端
浏览器端
浏览器 | 最大长度(字符数) | 备注 |
---|---|---|
Internet Explorer | 2083 | 如果超过这个数字,提交按钮没有任何反应 |
Firefox | 65,536 | |
chrome | 8182 | |
Safari | 80,000 | |
Opera | 190,000 | |
curl(linux下指令) | 8167 |
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/172528.html原文链接:https://javaforall.cn