Differences between get and post in http protocol, and getpost Protocol

Source: Internet
Author: User
Tags html header alphanumeric characters

Differences between get and post in http protocol, and getpost Protocol

We are no stranger to the get and post submission methods in the http protocol. Now we analyze the nature and difference of the two submission methods.
First, let's talk about the differences between the two of them:
Difference between the post and get methods in Form submission
1. get is to get data from the server, and post is to send data to the server
2. get adds the parameter data queue to the URL referred to by the ACTION attribute of the submission form. The values correspond to each field in the form one by one and can be seen in the URL. By using the HTTPpost mechanism, each field in the form and its content are placed in the html header and transmitted to the URL address referred to by the ACTION attribute. You cannot see this process.
3. For the get method, the server uses Request. QueryString to obtain the value of the variable. For the post method, the server uses Request. Form to obtain the submitted data.
4. The data volume transmitted by get is small and cannot exceed 2 kb. The amount of data transmitted by post is large, which is generally not restricted by default. Theoretically, the maximum size of IIS4 is 80 KB, and that of IIS5 is kb.
5. Low get security and high post security. (It is said that in https, the host path part except the URL is in plain text, and any other request content/responses are encrypted. Therefore, from this perspective: Compared with http GET, the GET method in https is safer. At least hackers can only obtain the ciphertext when listening to the channel;
However, because the URL of the GET method appears in the address bar and history of the browser (this is also true under https), it is still a security risk.
Therefore, https + post is the safest combination! )
HTTP Request
HTTP defines different methods for interaction with the server. The most basic methods are get and post. In fact, get applies to most requests, while retaining post is only used to update sites. According to the HTTP specification, get is used to obtain information, and should be secure and idempotent. The so-called security means that this operation is used to obtain information instead of modifying information. In other words, get requests generally do not have side effects. Idempotence means that multiple requests to the same URL should return the same result. The complete definition is not as strict as it looks. Basically, the goal is that when a user opens a link, she can be confident that the resource has not changed from her own perspective.
For example, the front pages of news sites are constantly updated. Although the second request will return a different batch of news, this operation is still considered safe and idempotent because it always returns the current news. And vice versa. Post requests are not that easy. Post indicates a request that may change resources on the server. Taking the news site as an example, the reader's comments to the article should be implemented through the post request, because the site is already different after the annotation is submitted (for example, an annotation appears below the article );
If Method is not specified during FORM submission, the default value is get. The data submitted in Form will be appended to the url? Separated from the url. Alphanumeric characters are sent as they are, but spaces are converted to "+". Other symbols are converted to % XX, where XX is the ASCII (or ISOLatin-1) value of the symbol in hexadecimal notation. The data submitted for the get request is placed in the HTTP Request Header, while the data submitted for the post is placed in the object data;
Data submitted in get mode can contain a maximum of 1024 bytes, whereas post mode does not.
Let's talk about the concept of idempotence.
Idempotence (idempotent and idempotence) is a mathematical or computer concept that is common in abstract algebra.
Idempotence has the following definitions:
For a single-object operation, if an operation is performed multiple times for all the numbers in the range, the result is the same as that obtained once, this operation is called idempotent. For example, an absolute value operation is an example. In a real number set, abs (a) = abs (a) is used )).
For binary operations, it is required that when the two values involved in the calculation are equivalent, if the calculation result is equal to the two values involved in the calculation, the operation is called the idempotence, for example, a function that calculates the maximum values of two numbers has the power in the real number set, that is, max (x, x) = x.
After reading the above explanation, you should be able to understand the meaning of the GET power.
In the next article, I will introduce in detail the nature and differences between http and https.

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.