1 HTTP Request
Hypertext Transfer Protocol (HTTP) is designed to ensure communication between the client and the server.
HTTP works through the request-response protocol between the client and the server.
For example, the client (browser) submits an HTTP request to the server, and the server returns a response to the client. The response contains the Request status information and content that may be requested.
Two common HTTP request methods: Get and post.
2 get method vs POST method
2.1 Operating Mechanism
The get method transmits user data through URL requests. Get adds the data in the form to the URL pointed to by action in the form of variable = value, and the two use "?" Connection, while each variable is connected with "&", such as [url] http://www.baidu.com? A = 1 & B = xyz [/url], data will be directly displayed on the URL;
The post method places the data in the form data body through the http post mechanism, and transmits the data to the URL pointed to by the action according to the method corresponding to the variables and values.
2.2 Value Method
Get $ _ Get [""]
Post $ _ post [""]
2.3 limit on Data Length
The size of data transmitted in get mode is very small, generally limited to around 2 kb, mainly because the URL length is limited, but the execution efficiency is better than the POST method;
The size of data transmitted in post mode is relatively large. It is waiting for the server to read data, but there are also byte restrictions to avoid malicious attacks against the server with a large amount of data.
2.4 Security
GET requests can be cached, stored in browser history, and added to favorites as bookmarks, which may cause security issues. For example, when you submit data through get on a login page, the user name and password will appear on the URL. If the page can be cached or other people can access the customer's machine, the user's account and password can be obtained from the history.
Therefore, we recommend that you use the POST method for form submission, especially when processing sensitive data.
2.5 restrictions on Data Types
Get restricts that the dataset value of the form form must be ASCII characters;
Post supports the entire iso000046 character set.
2.6 back button/refresh
When the request is rolled back or refreshed, the data in the POST request may be re-submitted (the browser should inform the user that the data will be re-submitted, or take measures to avoid re-submitting the data)