Is there a limit on the URL length?

Source: Internet
Author: User
Tags java throws

The reason is that the get method is passed through the URL, while the URL length is limited, and the POST method uses the stream method. Theoretically, there is no limit on the capacity that can be passed.
Now let's look at this description: "The URL length is limited." Where is the limit? What about browser or server? The results from Google show that the URL length is actually restricted by browser, for example, the URL Length of IE is 2083 bytes, opera is 4050, and Netscape is 8192. It is said that the HTTP protocol itself has no limit on the length of the get method. If you do not use a browser Program If httprequest is sent in, can the length of get be infinite? With this idea, we conducted the following experiments:

On the client side, implement it in Java, send httprequest to the server side, and use the get method.

On the server side, design an Apache module and output strlen (R-> ARGs) with ap_rprintf as response to return to the Java side.

By increasing the length of the string passed by the get method, it is found that when the URL length exceeds 8208 bytes, Java throws Io exception: server returned HTTP response code: 414 for URL :.....

What error does 414 mean?

414-request-URL too long (see: http://www.websitepulse.com/kb/4xx_HTTP_status_codes.html)

It can be seen that there is a limit on the URL length on the server side, so there is a limit on the data that can be transmitted by the get method. However, this restriction may vary depending on the server's processing capabilities, or where to configure it. (I started to guess again. This doesn't seem to be a good habit ).

The following is a preparation:

In fact, this is understandable, and there is no limit on the URL length. After all, the HTTP protocol is UDP, while a UDP package is limited in size. So why can post transmit large volumes of data? I have no deep understanding before trying to read Post Data in the Apache module. It's just a stream. In fact, the post data is read in parts during parsing. If you understand it from the UDP perspective, you can divide it into multiple UDP packets and then read them one by one.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.