Differences between post method and get method in http


1. Get is harmless when the browser goes back, but post will submit the request again;

2. The URL address generated by get can be collected, but post cannot;

3. Get requests will be actively cached by the browser, while post will not be actively cached unless manually set;

4. Get request parameters will be completely kept in the browser history, but post will not;

5. The parameters of get request in URL are limited in length, while post is not;

6. Get requests can only encode URL, while post supports multiple encoding methods;

7. The parameters of get request are passed through URL, and post is put in request body;

8. For the data type of parameters, get only accepts ASCII characters, but post has no limitation;

9. Get is more insecure than post, because the parameters of get request are directly displayed on the URL, and the parameter data is passed in plaintext, so the get method cannot be used to transfer sensitive information;

10. To get data from the server is to get data;

11. The amount of data transferred by the get method is small, and the maximum is no more than 2KB (because of the URL length restriction), while the post method is relatively large and generally unrestricted;

12. The get method will only generate a TCP packet. The browser will send the header and data together, and the server will respond to 200 (OK) and return the corresponding data.

The post method will generate two TCP packets. The browser will send the header first. After the server responds 100 (continue), the browser will send the data, and the server will respond to 200 (OK) and return the corresponding data.

So why is the post method so good that you still use the get method? becauseAlthough the get method is less secure, it is more efficient, andPost has high security and low efficiency

Learning process, simple records, if there is any inappropriate, welcome to correct!

Recommended Today


catalog How to learn CSS What is CSS History of development quick get start Advantages of CSS Three ways to import CSS Expansion: two ways of writing external style selector Basic selector Hierarchy selector Structure pseudo class selector attribute selectors Beautify web page elements Why beautify web pages Span label: for the text that needs […]