url最大长度限制(转) -凯发k8网页登录

standing on the shoulders of giants
posts - 481, comments - 486, trackbacks - 0, articles - 1
  凯发k8网页登录-凯发天生赢家一触即发官网 :: 凯发k8网页登录首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

url最大长度限制(转)

posted on 2013-05-30 09:29 疯狂 阅读(4156) 评论(0)  编辑  收藏 所属分类: 方法论架构

转自:

  1. url不能大于255bytes的说法确实存在,在中提到:

    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 , 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. 另外值得注意的是,有文章提到作为
    网站地图