When using the HTTP protocol, the client can tell the server the intent of its own request through the HTTP method.
After reading this article, who will say the HTTP method only get and post, your eyes are used to eat it!
One, get: Get Resources
Get is used to request access to the resource identified by the URI. Returns the contents of the response after the specified resource has been parsed by the server.
Get request and response examples
Second, POST: Transfer entity body
The post is used to transfer the entity body. Although the body of the entity can also be transferred with the Get method, it is generally not transmitted by the Get method, but by the POST method. Although the function of post is similar to get, the main purpose of post is not to get the main content of the response. (The difference between post and get, common face questions, there is a difference, get request length in different browsers in 2k-8k, not enough to upload big data files OH)
Post request and response examples:
Three, PUT: Transferring files
The PUT method is used to transfer files. Just like the FTP protocol file upload, it requires that the contents of the file be included in the body of the request message, and then saved to the location specified by the request URI.
Since the http/1.1 PUT method itself does not have a validation mechanism, anyone can upload files, there is a security issue, so the general Web site does not use this method. Using the PUT method may be possible if you are working with a Web application's validation mechanism, or if the architecture is designed to use a similar web site with REST (representational state Transfer, representational status transfer) standards.
Put request and response examples:
Four, HEAD: Get message header
Head and get, just do not return the main part of the text.
Head request and Response examples:
Five, delete: deleting files
The Delete method is used to delete a file, which is the opposite of PUT. The Delete method deletes the specified resource by the request URI.
The http/1.1 Delete method itself does not have the same validation mechanism as the PUT method, so the general Web site does not use the Delete method. It is still possible to use the WEB application's validation mechanism, or to comply with the REST standard.
Delete request and response examples:
Vi. options: Ask a supported method
The options are used to query the supported methods for the resources specified for the request URI.
Options request and Response examples:
Seven, trace: Trace path
The TRACE method is a method that allows the WEB server to loop back the previous request communication to the client.
When sending a request, fill in the number in the Max-forwards header field, minus 1 for each server side, and stop the transmission when the value is just down to 0 o'clock, and the last server that receives the request returns the response of the status code of OK.
The TRACE method allows the client to query how requests sent out are processed and modified/tampered with. This is because the request to connect to the source destination server may be brokered through a proxy, which is used to confirm a sequence of actions that occurred during the connection.
However, the TRACE method is not often used, plus it tends to trigger XST (Cross-site tracing, cross-site tracking) attacks, which are usually less useful.
Trace request and Response examples:
Eight, connect: Requires a tunneling protocol to connect the proxy
The CONNECT method requires a tunnel to be established when communicating with a proxy server to enable TCP communication with the tunneling protocol. The main use of SSL (secure Sockets layer, Secure Sockets layers) and TLS (Transport layer Security, Transport Layer Secure) protocol to encrypt the communication after the network tunnel transmission.
Connect request and Response examples:
Nine, link and unlink in http/1.1 have been abandoned, interested can understand.
HTTP Essentials Overview: Four, HTTP method