Get,post and head explanation

Source: Internet
Author: User

The three most common methods of HTTP requests:

(1) Get method. Retrieving any information from the request URL flag, accessing the Web page by entering the URL in the address bar of the browser, the browser uses the Get method to obtain resources from the server.

(2) Post method. Prepares data for request messages, which requires the requested server to accept the data appended to the request message, often used to submit the form.

(3) Head method. The class get method, which does not respond to the body portion of the page, is used to obtain basic information about the resource, which is to check the accessibility of the link and whether the resource is modified.


Other methods:

PUT Request server stores a resource and uses Request-uri as its identity
Delete Request server deletes the resource identified by the Request-uri
TRACE Requests the server to echo received request information, primarily for testing or diagnostics
CONNECT reserved for future use
Options request the performance of the query server, or query for resource-related choices and requirements

Problem with the Get method: The data submitted through get will appear on the URL. If the login page can be cached by the browser, then someone else can read the customer's account number and password from the browser's history. The amount of data sent by get is less than 2KB.

Post method Problem: The Post method requires the server to receive data, which may be unsafe for the server. Low execution efficiency

Suggestions:
1, get the security of the method is less than the post, including confidential information, it is recommended to use the Post data submission method;
2, when doing data query, it is recommended to use Get method, and in the data to add, modify or delete, the proposed post method;

Question: Why does Baidu search use get instead of post?

Can look at the content of the HTTP protocol HTTP request mainly there are three ways get,head,post, and IE initiates a request is generally included, the message header and the body, if the request is the way to get or head, then IE only send the message header to the server, if it is a POST request, Then the message body (Web page form content) and the message header will be transferred to the server, so that the amount of data is larger than the other two ways, so, according to the above, get way request, faster, but because the URL is exposed to the user, can lead to illegal attacks such as SQL injection, post-submission, The speed will be slower. However, because the URL is hidden in the form, so security is a little better, which is why the general login page is submitted with a post without a get commit

From the user experience: If the Post method search, Baidu's address bar has not changed, and with Get, the address bar has become a string of URLs. For the user, sometimes it is necessary to copy a page of the search URL, this time you have to use the Get method. And since the post mode is still there, it is certainly good, this may be completely from the technical point of view, such as stability and so on.

Get,post and head explanation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.