Simple understanding of GET/POST requests

l Not long after I came to the company for an internship, I encountered a big problem caused by a bug. Because some data was only verified by the front-end, the front-end verification was skipped directly in the URL, which caused a big problem. Fortunately, it was discovered and solved in time. , The reason for this bug is also related to GET/POST requests. Just in time, I also re-understand some of the differences between GET/POST requests. (It turns out that I actually learned it in class at school. Forgive me for not being particularly serious in class)

As far as I understand, the difference between GET request and POST request can be divided into:

GET: The GET request will put the data behind the URL (put the data in the header of the HTTP protocol), such as: login.action?name=hyddd&password=idontknow&verify=%E4%BD%A0%E5%A5%BD. If the data is English letters/numbers, send it as it is, if it is a space, convert it to +, if it is Chinese/other characters, directly encrypt the string with BASE64, and get such as: %E4%BD%A0%E5%A5% BD, where XX in %XX is the ASCII hex representation of the symbol.

The data length of GET requests should be limited, because remember that computer networking courses have learned about the maximum length of HTTP headers. In addition, I saw on the Internet that the GRT request only sends a request to the server once, and sends the header and data together. (I don't know if it is sent like this, and whether there will be a formal HTTP message in the future, and I will study it later).

POST: Compared with the GET request, the data in the POST request is written in the HTTP message body. There are many sayings on the Internet that the POST request data has no size limit. The size is also limited, each HTTP message is a fixed size, so I think this data size is not limited and should only be relative. (I will review some HTTP-related knowledge later), and finally I saw some explanations on the Internet. The POST request makes two requests to the server, one for header requests, and the other for data.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326081022&siteId=291194637
Recommended