zoukankan      html  css  js  c++  java
  • GET请求的请求参数最大长度

    在HTTP规范RFC-2616中有这样一段描述:

    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 RFC规范中并没有规定GET请求的URI长度,只是说明如果server无法处理太长的URI,可以通过返回414状态码。

    规范中虽然未对GET请求的长度做出明确的规定,但是在主流的用户代理浏览器和应用服务器中对GET请求却做出限制或者相关的可配置:

    • Chrome(谷歌)的url长度限制超过8182个字符返回本文开头时列出的错误。

    • IE浏览器(Microsoft Internet Explorer) 对url长度限制是2083(2K+53),超过这个限制,则自动截断(若是form提交则提交按钮不起作用)。

    • Apache能接受url长度限制为8192字符

    • tomcat中通过较多的Connector参数控制url长度限制:
      maxParameterCount:GET和POST请求参数个数,默认是10000
      maxPostSize:POST请求数据最大值

    • nginx可以通过修改配置来改变url请求串的url长度限制:
      client_header_buffer_size 默认值:1k
      large_client_header_buffers默认值:4 8k

    大多数浏览器的限制在2k-8k之间,更老的版本浏览器甚至只支持255 bytes。

    引用:

    https://stackoverflow.com/questions/2659952/maximum-length-of-http-get-request

    http://blog.chinaunix.net/uid-26602509-id-4495786.html

    https://www.jianshu.com/p/512389822f8b

  • 相关阅读:
    包的初识与使用
    时间 随机 模块
    规范化开发
    解析Javascript事件冒泡机制
    Java垃圾回收机制
    Java 垃圾收集机制
    javac 编译与 JIT 编译
    JAVA对文件类型的校验
    多态性实现机制——静态分派与动态分派
    类加载机制
  • 原文地址:https://www.cnblogs.com/lxyit/p/9017326.html
Copyright © 2011-2022 走看看