从http 414(Request-URI Too Long)说起------RFC并未限制URL的长度

转 原文链接:https://blog.csdn.net/stpeace/article/details/81262586

   在一些服务器中, 如果url过长, 会产生414错误(依赖于具体实现)。 也有很多人认为,get参数有长度限制, post没有限制。对吗? 显然不对。



   实际上, RFC并未规定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.

   

    对于url:

    在浏览器端, 以大众常用的IE为例, 限制大约是2K字节, 以程序员常用的chrome为例, 限制是8K字节。

    在服务端, 以最常见的apache服务器为例, 限制是8K字节, 其他服务器则可能各部相同。



    再强调一次, 即使在具体实现中有限制, 也是限制url, 而非整个请求体。 所以, 以经典的chrome + apache为例,  如果要传输1M的数据,当然不能放在http的url参数中, 所以一般不选择get, 而选择post.



    不多说。
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值