韦德国际1946英国 > 计算机网络 > URL最大长度限制,关于URL最大长度限制的相关资

原标题:URL最大长度限制,关于URL最大长度限制的相关资

浏览次数:184 时间:2019-08-10

在支付调节和测验支付宝接口时,忽地意识支付宝接口的UOdysseyL不长,远远大于此前本人印象中的2五十七个字符。赶紧找寻核准了一番,驾驭如下:

在付出调试支付宝接口时,卒然意识支付宝接口的UQashqaiL十分长,远远超越在此以前自身印象中的2伍十一个字符。赶紧寻觅核查了一番,精晓如下:

GET传参最大尺寸的知晓误区

时间:2016-10-17 14:59:38
作者:zhongxia
原稿地址:https://github.com/zhongxia245/blog/issues/35

U瑞虎L无法超出255bytes的说法的确存在,在途达FC2616中涉嫌:

  1. U凯雷德L无法压倒255bytes的说教实在存在,在RFC2616中提到:

    URL最大长度限制,关于URL最大长度限制的相关资料查证。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.

  2. 从上一些也能够见见,255bytes的布道也是为了兼容性缅怀。实际上当代浏览器的范围如下:

    Microsoft Internet Explorer (Browser)
    Microsoft states that the maximum length of a URL in Internet Explorer is 2,083 characters, with no more than 2,048 characters in the path portion of the URL. In my tests, attempts to use URLs longer than this produced a clear error message in Internet Explorer.
    Firefox (Browser)
    After 65,536 characters, the location bar no longer displays the URL in Windows Firefox 1.5.x. However, longer URLs will work. I stopped testing after 100,000 characters.
    Safari (Browser)
    At least 80,000 characters will work. I stopped testing after 80,000 characters.
    Opera (Browser)
    At least 190,000 characters will work. I stopped testing after 190,000 characters. Opera 9 for Windows continued to display a fully editable, copyable and pasteable URL in the location bar even at 190,000 characters.
    Apache (Server)
    My early attempts to measure the maximum URL length in web browsers bumped into a server URL length limit of approximately 4,000 characters, after which Apache produces a “413 Entity Too Large” error. I used the current up to date Apache build found in Red Hat Enterprise Linux 4. The official Apache documentation only mentions an 8,192-byte limit on an individual field in a request.
    Microsoft Internet Information Server
    The default limit is 16,384 characters (yes, Microsoft’s web server accepts longer URLs than Microsoft’s web browser). This is configurable.
    Perl HTTP::Daemon (Server)
    Up to 8,000 bytes will work. Those constructing web application servers with Perl’s HTTP::Daemon module will encounter a 16,384 byte limit on the combined size of all HTTP request headers. This does not include POST-method form data, file uploads, etc., but it does include the URL. In practice this resulted in a 413 error when a URL was significantly longer than 8,000 characters. This limitation can be easily removed. Look for all occurrences of 16×1024 in Daemon.pm and replace them with a larger value. Of course, this does increase your exposure to denial of service attacks.

  3. 除此以外值得注意的是,有作品提到作为<a>的href属性时,U奥迪Q5L无法超越1024bytes,那一点并未有详细应用研讨

零、总结

文章多少出自网络,大概存在变动,不过原理是同样的。

  1. HTTP 协议 未规定 GET 和POST的长度限制
  2. GET的最大尺寸彰显是因为 浏览器和 web服务器限制了 U牧马人I的尺寸
  3. 差异的浏览器和WEB服务器,限制的最大尺寸不一致样
  4. 要援助IE,则最大尺寸为2083byte,若只支持Chrome,则最大尺寸 8182byte

复制代码 代码如下:

综上,U昂CoraL依然不相符太长,不是可望而不可及,尽量不要通过GET情势提清华量参数,能够设想用POST格局(大约在2M左右,应该是和服务器及设定有关)。别的这么长的U智跑L在做客和收藏(有成文提到某些浏览器在深藏超长地址时也是会产出难题)时也是一对一不团结的。当然,此前数据库字段设置时大概作为255bytes拍卖,未来恐怕要挂念扩张学一年级下了。

一、误解

世家都晓得http 中 存在 GET 和 POST 那二种最常用的央求形式。(PUT,DELETE不在本文探讨范围以内)

误会:HTTP 协议下的 Get 央求参数长度是有大小限制的,最大不可能抢先XX,而 Post 是无界定的。

1、首先就是有长度限制,也是限制的是整个 URI 长度而不只是你的参数值数据长度

2、HTTP 协议未有规定 GET/POST 的乞求长度限制是稍微。

**以下内容摘自 《关于 HTTP GET/POST 央浼参数长度最大值的一个通晓误区》, 小说时间为 二零一一年的。恐怕以最近风靡的浏览器有出入 **

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.

3、所谓的呼吁长度限制是由浏览器web 服务器操纵和设置的,各类浏览器和 web 服务器的设定
均不均等,这正视于各类浏览器商家的规定或许能够依照 web 服务器的处理技术来设定。

The limit is in MSIE and Safari about 2KB, in Opera about 4KB and in Firefox about 8KB, (255 bytes if we count very old browsers) . We may thus assume that 8KB is the maximum possible length and that 2KB is a more affordable length to rely on at the server side and that 255 bytes is the safest length to assume that the entire URL will come in.
If the limit is exceeded in either the browser or the server, most will just truncate the characters outside the limit without any warning. Some servers however may send a HTTP 414 error. If you need to send large data, then better use POST instead of GET. Its limit is much higher, but more dependent on the server used than the client. Usually up to around 2GB is allowed by the average webserver. This is also configureable somewhere in the server settings. The average server will display a server-specific error/exception when the POST limit is exceeded, usually as HTTP 500 error.

IE 和 Safari 浏览器 限制 2k
Opera 限制4k
Firefox 限制 8k(特别老的版本 256byte)

假诺超越了最大尺寸,大部分的服务器直接截断,也是有一对服务器会报414谬误。


HTTP 1.1 defines Status Code 414 Request-URI Too Long for the cases where a server-defined limit is reached. You can see further details on RFC 2616. For the case of client-defined limits, there is no sense on the server returning something, because the server won't receive the request at all.

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).

参考:

详见能够看 福睿斯FC2616

The server is refusing to service the request because the Request-URI is longer than the server is willing to interpret. This rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query information, when the client has descended into a URI "black hole" of redirection (e.g., a redirected URI prefix that points to a suffix of itself), or when the server is under attack by a client attempting to exploit security holes present in some servers using fixed-length buffers for reading or manipulating the Request-URI.


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.

  1. What is the maximum length of a URL?
  2. What is the limit on QueryString / GET / URL parameters?
  3. 文章摘自:

二、种种浏览器和web服务器的最大尺寸计算

** 以下内容摘自《GET央浼中U揽胜L的最大尺寸限制总计》, 文章内容是 二零一四年6月,相对相比相符当下的时尚现状。 **

在网络查询之后,浏览器和服务器对url长度都有限量,现计算如下。

从上一些也得以看出,255bytes的布道也是为着包容性考虑。实际上今世浏览器的范围如下:

浏览器

1、IE

IE浏览器(Microsoft Internet Explorer) 对url长度限制是2083(2K 53),抢先这些界定,则自动截断(尽管form提交则交由开关不起效用)。

2、firefox

firefox(火狐浏览器)的url长度限制为 65 536字符,但实际有效的UCRUISERL最大尺寸非常的多于100,000个字符。

3、chrome

chrome(Google)的url长度限制超越8183个字符重临本文开首时列出的荒谬。

4、Safari

Safari的url长度限制至少为 80 000 字符。

5、Opera

Opera 浏览器的url长度限制为190 000 字符。Opera 9 地址栏中输入190000字符时还能健康编辑。

本文由韦德国际1946英国发布于计算机网络,转载请注明出处:URL最大长度限制,关于URL最大长度限制的相关资

关键词: 25 url length 长度 字符

上一篇:新伟德国际首页:无脑操作,基于EasyUI的基础之

下一篇:没有了