I. Introduction to the HTTP protocol
1. What is an agreement
Two people agreed to do the same thing (e.g., housing agreement)
2.HTTP is the agreement of WHO and WHO
HTTP protocol is the protocol between browser and server two objects
The English name of the 3.HTTP protocol (hypertext Transfer Protocol), which means Hypertext Transfer Protocol
What is super text. The text, pictures, and videos you see on the page are super-text.
4. Request Format
The browser sends the request to get the data, the server responds to the request
5.HTTP protocol How to get data through a browser to a Web page after a process.
The browser enters the URL (domain name), locates the corresponding IP address (IP uniquely identifies the computer), the DNS server translates the domain name to the IP to request the server.
DNS provided by Google (8.8.8.8)
Second, HTTP request
After the client connects to the server, it requests a Web resource from the server, which is called the client sends an HTTP request to the server
A complete HTTP request includes the following: A request line, several message headers, and entity content
Request Format:
The HTTP request format consists of four main parts: the request line, the request header, the blank line, the message body,--each part contains one row
2.1 Request Line:
The request line is the first line of the request message and consists of three parts: the request method (Get/post/delete/put/head), the URI path of the request resource, the version number of the HTTP
2.2 Request Header:
The information in the request header has a cache-related header (cache-control,if-modified-since), Client identity information (user-agent), and so on.
2.3 Message body:
The request body is the client's request data sent to the server, which is not required for each request.
iii. Details of HTTP response--Status line
Common response headers in HTTP response (message header) Location: The server passes this header to tell the browser where to jump to server: server through this header, tell the browser server model content-encoding: Server Through this header, tell the browser, Data compression format content-length: The server through this header, tells the browser the length of the loopback data content-language: The server through this header, tells the browser language environment Content-type: The server through this header, Tells the browser the type of ECHO data refresh: The server through this header, tells the browser to refresh Content-disposition: The server through this header, tells the browser to play data transfer-encoding: Server through this header, Tells the browser that the data is Expires in chunks:-1 control browser do not cache Cache-control:no-cache Pragma:no-cache
1. HTTP response Format:
The server returns an HTTP corresponding message to the client after the request has been processed. The format of the HTTP response message includes: status line, response header, blank line, message body. Each part contains one row.
3.1 Status line
The status line is located in the first line of the corresponding message, with the HTTP protocol version number, status code and status description three parts.
3.2 Response Header
A response header is some information that the server passes to the client to describe the server, and the policy when it continues to access the resource in the future.
3.3 Response Body
The response body is the HTML text content returned to the client by the server, or data in other formats, such as video streams, pictures, or audio data.