1. Basic Concepts
HTTP protocol, that is, Hypertext Transfer protocol. Defines the format of data exchange between the client and the Web server.
The application layer protocol of TCP/IP protocol.
2. Protocol version
HTTP/1.0 (disconnected)
After the client establishes a connection with the web server, only one web resource can be obtained.
HTTP/1.1 (keep connection)
Allow the client to establish a connection with the web server and obtain multiple web resources in a single connection
3. HTTP request)
A complete HTTP request includes
Use firebug to obtain HTTP request information for access to baidu.com, as shown in
GET www.baidu.com 200 OK (request line)
Resource Type received by the Accept client
Language type received by the Accept-Language Client
The compression type that the Accept-Encoding client can receive
Connection maintains the Connection between the client and the server.
Host connection destination Host
User-Agent client browser kernel version
Cookie client temporary server information
4. Common HTTP request methods
GET \ POST
Both requests WEB resources from the server.
GET method. The parameters attached to the URL are limited, and the data capacity cannot exceed 1 K.
POST method, you can send data to the server in the request object content
5. HTTP response (response)
An HTTP response indicates the data that the server sends back to the client.
It includes a status line, several message headers, and entity content.
Obviously, it is easy to understand the content in the response information. Note that,
Cache-Control whether the server allows the client to Cache data. In addition, there are two methods, respectively, for different browser environments.
Expires:-1
Cache-Control: no-cache
Pragma: no-cache
The preceding three methods are used to disable browser caching.
6. HTTP response status code
200 OK successfully received the request
302 the client requests resources, but the server does not have the corresponding resources. The server requires the client to request another server, that is, redirect
307 when the client requests resources, but the server does not have the corresponding resources, the server executes another request to another server, that is, the client requests are forwarded.
304 client request. In this case, the client cache does not need to download new resources from the server. The server requires the client to find the cache and optimize it.
404 resource does not exist
500 a server error occurs.
For more information, see Baidu encyclopedia.
Http://baike.baidu.com/view/1790469.htm