`
fishermen
  • 浏览: 377617 次
社区版块
存档分类
最新评论

经典收藏----URL的长度限制,以及get post区别[转载]

阅读更多

这个是官方的解释:http://support.microsoft.com/default.aspx?scid=kb;EN-US;q208427
长度是2083字节,路径的最大长度是2048字节, post和get都是,这已经远大于传说的256了(之前为了兼容老client的一个说明)

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

RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1," does not specify any requirement for URL length.
REFERENCES
For a further breakdown of the components, see the Wininet header file.

For more information, see "General Syntax," section 3.2.1 of RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1," at the following Internet Society Web site:ftp://ftp.isi.edu/in-notes/rfc2616.txt
下面的文章取自RFC更加的权威了http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-parameters.html

What is the limit on QueryString / GET / URL parameters?
RFC 2068 states:
Servers should be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations may not properly support these lengths.
The spec for URL length does not dictate a minimum or maximum URL length, but implementation varies by browser. On Windows: Opera supports ~4050 characters, IE 4.0+ supports exactly 2083 characters, Netscape 3 -> 4.78 support up to 8192 characters before causing errors on shut-down, and Netscape 6 supports ~2000 before causing errors on start-up.
 
Note that there is no limit on the number of parameters you can stuff into a URL, but only on the length it can aggregate to.
 
Keep in mind that the number of characters will be significantly reduced if you have special characters (e.g. spaces) that need to be URLEncoded (e.g. converted to the sequence '%20'). For every space, you reduce the size allowed in the remainder of the URL by 2 characters - and this holds true for many other special characters that you may encode before sending the URL to the client.
 
Keep in mind, also, that the SGML spec declares that a URL as an attribute value (e.g. <a href='{url}'>) cannot be more than 1024 characters. Similarly, the GET request is stored in the server variable QUERY_STRING, which can have similar limitations in certain scenarios.
 
If you are hitting a limit on length, you should consider using POST instead of GET. POST does not have such low limits on the size of name/value pairs, because the data is sent in the header, not in the URL. The limit on POST size, by default, is 2 MB on IIS 4.0 and 128 KB on IIS 5.0. POST is also a little more secure than GET -- it's tougher (though not impossible) to tinker with the values of POSTed variables, than values sitting in the querystring.
 
See Article #2223 for more information on using POST to overcome limitations on length.

下面的文章讲述克服get的长度限制, 使用post
http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-parameters.html

转自 http://www.80x86.cn/article.asp?id=1327

分享到:
评论

相关推荐

    android基础 - POST GET

    - POST:请求参数放在请求体中,不受URL长度限制,可以传输大量数据和敏感信息。 2. 安全性: - GET:因为参数显示在URL上,所以易于被缓存、记录,相对不安全。 - POST:参数在请求体中,相对更安全,但并非...

    ajax POST 与GET提交的区别

    - **GET**: 由于URL长度的限制(不同浏览器有所不同,通常不超过2K字节),GET请求能传输的数据量较小。 - **POST**: 没有明确的长度限制,理论上可以传输较大的数据量。 3. **安全性**: - **GET**: 由于数据...

    Ajax中get和post区别

    "Ajax中Get和Post请求的区别" Ajax作为异步JavaScript和XML的简写,是一种创建交互式网页的技术。其中,Get和Post是两种常用的HTTP请求方法,尽管它们都是用于将数据从客户端发送到服务器端,但是它们之间存在着很...

    get、post区别

    - **GET**:受URL长度限制,通常最大为2048个字符,因此不适合传输大量数据。 - **POST**:没有固定的大小限制,理论上可以传输大量数据,但实际应用中也会受到服务器配置和性能的限制。 #### 4. 编码格式 - **GET*...

    PHP GET 和 POST 的区别

    - 数据长度限制:由于URL长度有限,GET请求传输的数据量通常不超过2KB。 - 不适合敏感数据:由于数据明文传输,不应用来传递密码、信用卡号等敏感信息。 - 可被缓存:GET请求可以被浏览器缓存,也可能出现在浏览器的...

    浅谈HTTP中Get与Post的区别

    ### HTTP中的GET与POST区别详解 #### 一、概述 HTTP (Hypertext Transfer Protocol) 是互联网上应用最为广泛的一种网络协议,它定义了客户端与服务器之间的通信规则。在HTTP协议中,定义了多种请求方法来实现不同的...

    get和post的区别

    - 受到URL长度限制(大多数浏览器限制为2048个字符),因此不适合传输大量数据。 - **POST**: - 没有明确的数据大小限制,理论上可以传输非常大的数据量。 #### 5. 编码格式 - **GET**: - 默认使用ASCII编码...

    Http协议中POST和GET方法的本质区别

    GET请求的URL长度有限制,因此不适合传输大量或敏感数据,而POST请求则不受此限制。此外,GET请求的数据会显示在浏览器的历史记录和书签中,POST请求的数据则不会,这对隐私保护有一定影响。 在RESTful架构中,HTTP...

    get、post登录

    - 数据量:GET有长度限制,POST无明确限制,理论上可以传输大量数据。 - 缓存:GET请求可被浏览器缓存,POST请求一般不被缓存。 - 历史记录:GET请求会被保存在浏览器的历史记录中,POST请求则不会。 - 重播:GET...

    post和get的区别

    - 受URL长度限制,一般来说不超过2KB。 - **POST**: - 将请求参数放在HTTP消息体中。 - 参数不直接展示在URL中。 - 虽然理论上POST没有长度限制,但在实际应用中服务器可能会设置最大传输量,如IIS4限制为80KB,...

    GET-AND-POST.rar_ post CSharp _C# GET POST_CSharp post_POST_pos

    - GET适合获取数据,且数据量小,因为URL长度有限制。 - POST适合发送大量数据或创建新资源,数据不会显示在URL中,更安全。 6. **C#与HTTP请求库**: - `HttpClient`是.NET Framework 4.5及更高版本推荐的HTTP...

    jsp中post和get传输方式的区别

    - GET:受URL长度限制,一般来说,URL的最大长度为2KB左右。因此,当需要发送大量数据时,GET方法可能不是最佳选择。 - POST:没有明确的数据大小限制。实际上,数据大小主要受到服务器端的限制(如内存等)。因此...

    深入理解get与post方法的差别

    2. **限制条件**:由于数据是通过URL传递的,因此GET请求的长度受限于URL的最大长度,这意味着GET请求能携带的数据量有限制。 3. **缓存机制**:GET请求可以被浏览器缓存,这意味着相同或相似的GET请求在后续的调用...

    解决URL长度的问题

    1. **使用POST请求**:相较于GET请求,POST请求的参数不会添加到URL中,因此不受URL长度限制。适合传输大量数据或敏感信息。 2. **使用Hash(#)**:HTML5引入的History API允许在URL的Hash部分添加数据,但这只...

    GET与POST用法

    - **数据大小限制**:GET方法受URL长度限制,因此不适合传输大量数据;而POST方法没有明确的大小限制。 - **缓存机制**:GET请求可以被浏览器缓存,而POST请求则不会被缓存。 - **幂等性**:GET请求是幂等的,多次...

    get与post实例

    本文将深入探讨GET和POST的区别、应用场景以及VB(Visual Basic)中如何使用它们。 GET和POST是HTTP请求的核心方法,用于从服务器获取数据或向服务器发送数据。GET主要用于从服务器获取资源,它的参数通常显示在URL...

    get和post请求的区别.zip

    - GET:由于URL长度限制,GET请求的数据量通常不超过2KB。 - POST:理论上POST请求没有数据大小限制,但实际操作中受服务器和浏览器限制,一般在几MB左右。 4. **幂等性** - GET:幂等性意味着多次相同请求应...

    关于HTML的Form的get和post

    GET方法是最常见的一种提交方式,它将表单数据附加到URL后面,以问号(?)分隔。例如,如果表单中有两个字段name和email,那么提交后的URL可能会变成`http://example.com/form?name=value&email=value2`。这种形式的...

    URL 长度有限制吗?

    标签明确指出是"URL长度限制",这部分内容则通过实验展示了即使在不通过浏览器发送请求时,URL长度也存在限制,并且这一限制发生在服务器端。 首先,我们要理解GET和POST方法的基本概念。GET方法通常用于获取资源,...

    C++实现HTTP GET,POST请求

    C++实现POST请求时,除了构造请求头,还需添加Content-Length字段表示请求体的长度,以及实际的请求体内容: ```cpp void sendHttpPostRequest(const std::string& url, const std::string& postData) { // 同样...

Global site tag (gtag.js) - Google Analytics