A few days ago a classmate asked me what is the difference between get and post, I only know the difference between get and post is as follows:
1.GET the requested data will be appended to the URL, post will put the submitted data in the packet of the HTTP packet;
The data submitted in 2.GET can only be 1024 bytes, in theory post has no limit, can transmit a large amount of data;
3.POST security is higher than get.
Today I Baidu search for a bit, understand the difference between get and post six points:
1.GET is used to obtain data from the server, and post is used to pass data to the server;
2.GET adds the data in the form to the URL that the action points to by Variable=value, and both use "? "Connect, and use the" & "connection between the variables; Post is the data in the form in the data body, according to the variables and values corresponding to the way the action points to the URL;
3.GET is not secure, because in the transfer process, the data is placed in the requested URL, and now many existing servers, proxy servers or user agents will log the request URL to the journal file, and then put in a place, so that there may be some privacy information to be seen by third parties, in addition, Users can also directly see the submitted data in the browser, some of the system's internal information will be displayed in front of the user, post all the operation of the user is not visible;
4.GET transmits a small amount of data, which is mainly limited by the length of the URL, and post can transfer a large amount of data, so upload files can only use post;
5.GET the value of the dataset that restricts the form form must be an ASCII character, while Post supports the entire ISO10646 character set, which is iso-8859-1 encoded by default;
6.GET is the default method for form.
However, this is only the most common online answer, the next point of view denies the above mentioned the difference between get and post, the specific analysis is as follows:
1.GET and Post have no relationship with how data is delivered
Get and post are defined by the HTTP protocol. In the HTTP protocol, method and Dageta (Url,body,header) are two orthogonal concepts, that is, there is no correlation between the method used and how the application layer's data is transmitted.
HTTP is not required, if the method is post will put the data in the body, there is no requirement, if the method is get, the data (parameters) must be placed in the URL, rather than in the body. The Get method puts the data behind the URL, and the Post method puts the data in the body just the HTML standard for the use of the HTTP protocol Convention.
2.HTTP protocol has no limit on the length of Get and post
The HTTP protocol explicitly states that neither the HTTP header nor the body has a length requirement. There are two reasons for the limit on URL length:
1, browser. It is said that the early browser will limit the length of the URL.
2, server. The URL is long and is a burden on server processing. Originally a reply there is not much data, now if someone maliciously constructs a few m-size URLs, and constantly access the server, the server's maximum concurrency will obviously decline. As a result of security and stability considerations for most servers, the length of the URL is limited, but this restriction is for all HTTP requests, and is not related to get and post.
I personally think that the above point of view for Get and post the difference between the analysis have some reason, but they analyze the angle is different, the former is from the client and server perspective to analyze the difference between get and post, and the latter is from the HTTP protocol itself to analyze the difference between get and post.
The difference between get and post