What 1.HTTP protocol is?
Refers to a predetermined communication protocol is necessary to abide by the rules or a computer communication network between two computers, the HTTP (Hypertext Transfer Protocol) is the most widely used on the Internet is a network protocol, is used from the web (WWW : World Wide Web) server to transfer hypertext transfer protocol local browser.
2. Send the HTTP request?
When you enter the browser address bar URL, carriage return after the launch of the HTTP request
URL (Uniform Resource Locator) is also known as web address is the address of Internet standards
protocol :// hostname[:port] / path / [;parameters][?query]#fragment
Protocol: // hostname [: port number] / path / [; parameters] # pieces of information [query?]
For example: http: //www.xxser.com/post/httpxieyi.heml is a standard URL
3.HTTP request and response?
HTTP Request: it consists of three parts: the request line (request method), the request header (header message), the request body (request body)
HTTP response: also includes three parts: a response line, header response (message header), in response to the body (body of the response, the message subject)
4.HTTP request method:
The most common are GET and POST
HTTP request methods are GET, POST, opions, Put, Head, Delete, Trace, Connect
5.HTTP status code
When the first line of the client sends an HTTP request, the client sends the server as acceptance response message, wherein the response is the most important point is the HTTP status code as follows:
HTTP/1.1 200 ok
This status code is 200, showing the success of the request in the HTTP protocol, the HTTP protocol status code composed of three digits, the first digit of the response categories are defined, and only in response to the following five:
(1) 1XX message - indicates that the request has been successfully received, processing continues, in the range of 100-101
(2) 2XX success - indicates that the request has been successfully received, understood that acceptance, in the range of 200-206
(3) 3XX Redirection - redirection status code that tells the browser client, access to resources, they have been moved, and tell the client resources to address new position. In this case, the browser will re-initiate requests for new resources, ranging from 300-305
(4) 4XX error status code client - the client sometimes some of the things the server can not send requests, such as malformed request, or the most common request a non-existent URL. In the 400-415 range
(5) 5XX server-side error - sometimes the client sends a valid request, but the web server itself wrong, it may be a web server running wrong, or that the site hangs up, 5XX is used to describe an internal server error , in the range 500-505
Was common status codes are as follows:
200: The client request was successful 302: Redirect
404: The requested resource does not exist 400: The client requests a syntax error, can not be understood by the server
401: 403 Unauthorized request: server receives the request, but refused to provide services
500: internal server error is the most common status 503: The server is currently unable to process the client's request, may return to normal after a period of time
6.GET and difference POST (official answer)
url parameters get passed, post in the request body
get request parameters passed in the url is the length restricted, but no post
get more secure than POST, because the url parameter directly exposed, it can not be used to transmit sensitive information.
get up only the url encoding, and support multiple encoding post
get the browser will request the active cache, and support multiple encoding post
get request parameters will be retained in full browsing history, the post and the parameters are not retained
GET and POST on the nature of the link is TCP, and non-discriminatory. However, due to the provisions of HTTP and the browser / server, causing them to reflect some differences in the application process
GET generates a TCP packet; generating the POST two TCP packets