The difference between GET and POST (2)

Limit a problem, GET and POST length

GET

  1. GET is the maximum length of the data submitted by the URL, so the amount of data can be submitted by just GET URL can achieve are directly related.
  2. In fact, the HTTP protocol URL length is unlimited; URL length limit most of the configuration parameters of the browser or server

POST

  1. The same, HTTP POST protocol no any limitation, is generally restricted by the configuration server or a memory size.
  2. Under PHP can modify postmaxsize php.conf to set the size of the POST.

2. A request for content-length header of the problem

If someone maliciously forged a lot of content-length header, but actually send content-length small request, so that the server will always be dry and so on, until the timeout. Of course, the server can avoid this problem by setting

Third, the security GET and POST

  1. GET is by way of URL requests, we can directly see the plaintext transmission.
  2. POST request through the request header, or packet capture tool developers can see, it is also clear text. 
  3. GET request will be saved in the browser history, also may be saved in a Web log.

Four, GET and POST status of the server

According to http design, we get to see at the time, expect the requests to the server without modification, see post, we both thought it had a modification to the server.

Five, GET idempotent, POST is not idempotent

Idempotent request is referring to the same method of performing a plurality of times and is performed only once in exactly the same effect.

  1. According to the RFC specification, PUT, DELETE, and security methods are idempotent. Though this is the norm, but the server can not be achieved if idempotent ensured.

  2. Idempotent introduced primarily to deal with a case where the same request a repeat transmission, such as lost connection request response before, if the method is idempotent, can safely resend request. This is also the reason the browser encounters POST will prompt the user at the time of backward / Refresh: POST is not idempotent semantics, repeat requests may have unintended consequences.

  3. For example, in the microblogging scene, GET semantics will be used in the "Look on my Timeline latest 20 micro-Bo" such a scene, and POST semantics will be used in a "micro-Bo, comments, thumbs up "such a scenario.

Published 109 original articles · won praise 101 · views 360 000 +

Guess you like

Origin blog.csdn.net/Alen_xiaoxin/article/details/105160237