- Differences in working methods:
Get requests can have parameters or no parameters. If there are arguments, the arguments are placed at the end of the URL.
Get has a general limit on URL length. Most browsers support a length of around 2000 characters, and the default length of Apache is typically 8,000 characters. And because URL-to-character encoding uses ASCII code instead of Unicode, the use of Get requests requires encoding and retransmission if there are non-ASCII codes in the parameters.
Post requests generally have parameters, because post requests without parameters have no meaning. But the post parameter is placed in the newspaper style and is not placed behind the URL. And there is no limit to the style length of the Post report. The limit of the length of our common POST request message is generated by the server.
- The difference between the applicable scenarios
Get applies to requests that pass fewer parameters and are all ASCII characters, but a GET request can also pass illegal characters, except that it needs to be encoded (a percent-semicolon code) before being passed.
Post is for requests that pass many parameters and contain more special characters (such as Chinese). In addition, Post applies to modified requests, such as changing the password and, in summary, submitting the data to the server for processing.
- The difference in efficiency
Get requests are more efficient than post requests, so general resource requests are made with get.
|
GET |
POST |
| Click the Back/Refresh button |
No impact |
The data will be resent (the browser will prompt the user "data is being resubmitted") |
| Add Bookmark |
OK |
No |
| Cache |
OK |
No |
| Encoding type (Encoding type) |
application/x-www-form-urlencoded |
Application/x-www-form-urlencoded or Multipart/form-data. Please use multipart encoding for binary data |
| Historical records |
Yes |
No |
| Length limit |
Yes |
No |
| Data type Restrictions |
Only ASCII character types are allowed |
There is no limit. Allows binary data |
| Security |
The query string is displayed in the URL of the address bar and is not secure, please do not submit sensitive data using GET requests |
Because the data is not displayed in the address bar and is not cached or saved in the browsing history, it is safer to look at the POST request than the GET request, but it is not the safest way. If you need to transfer sensitive data, use encrypted mode to transfer |
| Visibility of |
The query string is displayed in the URL of the address bar, visible |
The query string is not displayed in the Address bar, not visible, |
Above table reproduced from http://www.cnblogs.com/igeneral/p/3641574.html
What we generally call post than get security is not to say what encryption is present in post by default, but that get is more susceptible to exposing sensitive information than post. These exposures originate from the get request parameter in the URL and the GET request can be cached by the browser, and if the link is shared it can cause a third party to commit and potentially create unexpected actions. If you want to transfer safely, you still need to use cryptographic measures.
Get and Post