The method of HTTP request: GET and POST

  • HTTP, GET, POST-related

HTTP is based on TCP / IP protocol on how to communicate data on how the World Wide Web.

Two kinds of HTTP request methods: GET and POST

Request between the client and the server - response, the two most commonly used methods are: GET and POST.

  • GET - request data from the specified resource.
  • POST - submission of data to be processed to the specified resource

The most intuitive difference is that the GET parameters in the URL, POST body parameters passed by request.

  • Compare GET and POST

The following table compares the two HTTP methods: GET and POST.

  GET POST
Back button / Refresh harmless Data will be re-submitted (the browser should inform the user that the data will be re-submitted).
Bookmark Can be bookmarked Not bookmarked
Cache Be cached You can not cache
Encoding type application/x-www-form-urlencoded application / x-www-form-urlencoded or multipart / form-data. The use of multiple encoded binary data.
history Parameters remain in the browser history. Parameters are not saved in the browser history.
Restrictions on data length Yes. When transmitting data, GET method to add data to the URL; URL length is limited (maximum length of the URL is 2048 characters). Unlimited.
Restrictions on data type Allows only ASCII characters. no limit. Also allows binary data.
safety

Compared with POST, GET poor security, because the data sent is part of the URL.

When sending passwords or other sensitive information should never be used GET!

POST is more secure than GET, because the parameters are not saved in the browser history or web server logs.
Visibility Data in the URL is visible to all. Data is not displayed in the URL.

 

HTTP is the underlying TCP / IP. So the bottom GET and POST is TCP / IP, that is to say, GET / POST is a TCP connection. GET and POST can do is the same as the same. Plus you give GET request body, to bring POST url parameter, technically completely do the same in. 

However, due to the provisions of HTTP and the browser / server, causing them to reflect some differences in the application process.

 

GET and POST there is a significant difference:

GET generates a TCP packet; generating the POST two TCP packets.

- "the GET request, the browser will http header and data sent together, the server response 200 (return data);

- "As for the POST, the browser transmits the first header, the server response 100 continue, the browser then transmits data, in response to the server 200 ok (return data).

Because POST requires two steps, the time to consume a little more, it seems more effective than GET POST.

Guess you like

Origin www.cnblogs.com/Face-All/p/11606338.html