one, HTTP protocol overview
HTTP Full name (Hypertext Transport Protocol), the Hypertext Transfer Protocol, which specifies the rules for communicating with each other between the browser and the World Wide Web server.
HTTP is a communication rule that specifies the format of the client-side content sent to the server, i.e. ( Request protocol ). Server-side content format to client, i.e. ( Response protocol )
Characteristics:
HTTP is called Hypertext Transfer Protocol, which is based on the request mode and the response mode
HTTP is a stateless protocol
URL: Uniform Resource Locator, is a URL: protocol name:/ / domain : port / path,
Example:http://www.oldboy.cn:80/index.html
two, request agreement.
The request format is as follows:
1, request the first line # Request Way Request path Protocol and version, for example: get/index.html http/1.1#//Request Header name: request header content, that is, the Key:value format , for example: Host:localhost3, empty line # header information and request body split line 4, request body (Request data)#get no request body, only post has request body
The browser sends the contents of the server to this format, if not this format the server will not be able to interpret! In the HTTP protocol, there are many request methods for requests, the most common of which is GET and POST. The difference between the different request methods is followed by a 1.1-point introduction.
2.1GET request
The HTTP default request method is get
* No request body
* Data must be within 1K!
* GET request data is exposed in the browser's address bar
Get requests commonly used actions:
1. Give the URL directly in the address bar of the browser, then it must be a GET request
2. Clicking on a hyperlink on the page must also be a GET request
3. When submitting a form, the form uses the GET request by default, but can be set to post
Web-----------HTTP protocol