“This is the 7th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”

Http On the difference between Get and POST

Get and POST are two common HTTP methods. Although it is said to be a classic essay, but the total feeling of understanding is not particularly accurate and in-depth. This article is mainly to make a summary and sort out some controversial points.

What are Get and POST?

GET and POST are HTTP request methods. In addition to these two request methods, HTTP also has six request methods: HEAD, PUT, DELETE, TRACE, CONNECT, and OPTIONS.

Second, the characteristics of

  • GET is used to GET information, is side-effect-free, idempotent, and cacheable
  • POST is used to modify data on the server. It has side effects, is not idempotent, and is not cacheable

Third, the difference between

1. W3school standard answer

First of all, let’s play the w3School standard answer. This basically includes the common distinction between Get and POST.

2. Separate summaries

HTTP protocol specification level:

  1. According to the HTTP specification, GET is used for information retrieval and should be secure and idempotent.

Security refers to non-modifying information, that is, the operation is used to retrieve information rather than modify it. In other words, a GET request should generally have no side effects, that is, it simply gets the resource information, just like a database query, without modifying, adding data, or affecting the state of the resource. Idempotence refers to HTTP methods that have no different results no matter how many times the URL is called. In practice, the rules are less strict.

The idempotent concept here is not quite the same as the definition in mathematics or computer science.


  1. According to the HTTP specification, POST represents a request that may modify a resource on the server.

POST requests are inherently non-idempotent.

HTTP presentation layer:

  1. The data of a GET request is appended to the URL (that is, put the data in the HTTP protocol header) to? Split URL and transfer data, parameters are concatenated with &. If the data is English letters/digits, send it as is, if it is space, convert it to +, if it is Chinese/other characters, then the string is directly encrypted with BASE64, such as: %E4%BD%A0%E5%A5%BD, where XX in % XX is the HEXadecimal ASCII of the symbol. POST places the submitted data in the request body of an HTTP package.

    (1) From the perspective of packet data, there is no substantial difference between GET and POST methods, but different packet formats. It is technically possible to place parameters in the request body in the Get method and in the URL in the POST method, provided that the server can parse and handle them correctly.


  1. The URL submitted in GET mode is 2048 bytes. Theoretically, there is no limit on POST. (1) GET is to submit data through URL, so the amount of data that can be submitted by GET is directly related to the length of URL. However, in fact, HTTP protocol specification does not limit URL length, so there is no upper limit of URL parameters from the level of protocol specification. This restriction is restricted by specific browsers and servers.

    Internet Explorer limits the URL length to 2083 bytes (2K+35). For other browsers, such as Netscape, FireFox, etc., there is theoretically no length limit, which depends on the operating system support.

    Also note that you are limiting the entire URL length, not just the data length of the parameter part.

    (2) HTTP protocol specification does not limit the size of POST requests, so from the level of protocol specification, THERE is no size limit for POST. But the processing power of the server can be limiting.

Fourth, some uncertain problems

  1. POST method produces two TCP packets?

As mentioned in some articles, POST will send the header and the body separately, sending the header first and the server returning the 100 status code before sending the body.

The HTTP protocol does not specify that POST produces two TCP packets.

Therefore, sending headers and bodies separately is a specific behavior of the browser or framework, not the nature of the POST method itself.








Refer to the article: in 9102, also asked the difference between the GET and POST HTML in the introduction to the HTTP request method the difference between the GET and POST the GET and POST the difference between the GET and POST the difference between a detailed explanation