Eight kinds of HTTP request method

1.options: Returns the server or web server sends a request method for a particular resource supports HTML test server function (allows the client to view server performance)
2.Get: requesting (request specified page information, and return the bodies of topics) to a specific resource
3.Post: submit data to the specified resource for processing a request (submitting a form, upload a file), it may lead to a revision of existing resources or establish new resources
4.Put to upload their content to the latest specified resource location (from the client data transmission to the content server specified document substituted)
5.Head get request to the server with the same cable corresponding, it does not return the response body, comprising obtaining the original amount of information (similar to the get request in the message header, no corresponding return specific content for acquiring the header)
6.Delect request-URL request to the server to delete the indicated resource
(delete a page request to the server)
request 7.Trace echo server receives, for testing and diagnostic
8.Connect HTTP / 1.1 protocol It can be connected to the pipe way of the proxy server

http server to achieve at least get, head, post method, others are optional
distinguish get and post requests?
1. The standard answer
when GET fallback in the browser is harmless, and POST will submit the request again.
GET URL address can be generated Bookmark, and not POST.
GET requests are active cache browser, POST will not, unless manually.
GET request can only be url encoded, and POST supports multiple encoding.
GET request parameters are intact in the browser history, and the POST parameters will not be retained.
GET request transmitted in the URL parameters are limited length, without the POST.
The data type of the parameter, GET accepts only ASCII characters, but there is no limit POST.
GET more secure than POST, because the parameters directly exposed on the URL, it can not be used to transmit sensitive information. GET parameters passed via the URL, POST Request body in place.

2. In-depth answers
GET and POST HTTP protocol are two ways to send the request.
HTTP is based on TCP / IP communication protocol on how to how the data is the World Wide Web. (HTTP is the underlying TCP / IP. So the bottom GET and POST is TCP / IP, that is to say, GET / POST and POST are TCP link .GET can do is much the same as you are to give GET plus requestBody, to bring POST url parameter, the technically completely do the same).
the GET generates a TCP packet; POST generates two TCP packets. (The GET request, the browser will http header and data sent together, the server response 200 (return data); for the POST, the browser transmits the first header, the server response 100 continue, the browser then transmits data, the server response 200 ok (return data))



Author: Heavy_Dream
link: https: //www.jianshu.com/p/d0e76ba01c1c
Source: Jane books

Guess you like

Origin www.cnblogs.com/GinaHan/p/11299381.html