首页 > 其他分享 >http get 方式参数的长度限制

http get 方式参数的长度限制

时间:2022-12-23 16:44:23浏览次数:55  
标签:http Explorer get URL maximum length characters Internet 长度

这个问题一直以来似乎是被N多人误解,其实Http Get方法提交的数据大小长度并没有限制,而是IE浏览器本身对地址栏URL长度有最大长度限制:2048个字符。

当您从 WinInet 应用程序到 Web 服务器发送一个长的查询字符串时,查询字符串可能会被截断。

出现此问题是由于中 WinInet,定义 Wininet.h 文件中,如下所示的 URL 的长度限制:

#define INTERNET_MAX_PATH_LENGTH        2048  
#define INTERNET_MAX_SCHEME_LENGTH      32          // longest protocol name length  
#define INTERNET_MAX_URL_LENGTH         (INTERNET_MAX_SCHEME_LENGTH + sizeof("://") + INTERNET_MAX_PATH_LENGTH)  

此行为是设计使然。

 

注意: 因为 Internet Explorer 和 Internet 传输的控制也使用 WinInet,可能会出现相同的问题。

若要解决此问题,使用 HTTP POST 方法。

http://support.microsoft.com/kb/208427/zh-cn

Microsoft Internet Explorer has a maximum uniform resource locator (URL) length of 2,083 characters. Internet Explorer also has a maximum path length of 2,048 characters. This limit applies to both POST request and GET request URLs. ‘>以下附上微软官方的一段说明:

Microsoft Internet Explorer has a maximum uniform resource locator (URL) length of 2,083 characters. Internet Explorer also has a maximum path length of 2,048 characters. This limit applies to both POST request and GET request URLs. ‘>Microsoft Internet Explorer has a maximum uniform resource locator (URL) length of 2,083 characters. Internet Explorer also has a maximum path length of 2,048 characters. This limit applies to both POST request and GET request URLs.

If you are using the GET method, you are limited to a maximum of 2,048 characters, minus the number of characters in the actual path.

However, the POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the header and not in the URL. ‘>However, the POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the header and not in the URL.

RFC 2616, “Hypertext Transfer Protocol — HTTP/1.1,” does not specify any requirement for URL length.

标签:http,Explorer,get,URL,maximum,length,characters,Internet,长度
From: https://www.cnblogs.com/kn-zheng/p/17001026.html

相关文章

  • 关于gets函数和scanf函数
    关于gets函数和scanf函数,都会在末尾上加‘\0’的,要不然字符串就无法结束了。他们的不同在于,scanf在碰到缓冲区的空字符时(TAB,空格,换行,回车)时会自动截断并添加0.而gets函......
  • Spring Security系列教程04--实现HTTP基本认证
    前言在上一章节中,​​一一哥​​带大家搭建了第一个SpringSecurity项目,相信小伙伴已经学会了如何利用SpringSecurity来保护我们的JavaWeb项目。但是第一个案例只是属于H......
  • MultipartHttpServletRequest: is a MultipartResolver configured?解决办法
    MultipartHttpServletRequest:isaMultipartResolverconfigured?解决办法一.问题描述今天在做商城项目时,要将图片上传到FastDFS服务器,突然出现了如下异常:java.lang.I......
  • 实用干货!看壹哥如何在SpringBoot项目中同时支持https和http协议
    最近壹哥的一个学生在做项目时碰到了一个特殊的需求,前端浏览器需要存放跨域请求的cookie,需要将cookie的secure属性设置为true。这样一来,就要求后端的接口必须以HTTPS协议提......
  • python3 gettext pybabel的使用
    1.pipinstallbabelhttps://www.osgeo.cn/babel/cmdline.html#2.编写要翻译的文件importgettextt=gettext.translation('spam','./locale',languages=['en'])t......
  • git系列---【解决git clone时fatal: unable to access ‘https://gitee.com/XXX.git/
    1.常见原因:无权访问,可能是本机录入的gitee账号和现在要进行clone的gitee账号不同导致的权限问题2.解决方法:1)控制面板--用户账户--凭证管理器--windows凭据2)点击编辑更......
  • http状态码的分类
    1xx 服务器收到请求2xx 请求成功3xx 重定向4xx客户端错误5xx服务端错误 500服务器错误 504网关超时 http缓存什么是缓存?为什么需要缓存?哪些资源可以被......
  • 一文搞懂HTTPS的握手方法
    HTTPS握手方法加密加密的大致种类:不可逆加密。比如MD5、SHA、HMAC小明将文件加密得到一串密码a,并把文件和密码a给小红,小红拿到文件之后使用同样的算法得到密码b,......
  • 远程服务器返回错误: (411) 所需的长度。
    最近在项目上遇到了问题是:411错误,出现这个错误可能是再请求POST的时候,若没有参数的情况下,需要把 HttpWebRequest的长度设置为0,req.ContentLength=0;publicstringHttpPo......
  • Python requests库指定IP请求,并使用HTTPS证书验证
    背景运维同学通过网关平台下发nginx配置文件,下发的过程是先灰度发布,发灰度机器,然后需要验证域名的请求是否正常,然后在下发其他生产机器,但是验证过程是人为操作,这就不可避......