The following gets the HTTP headers returned by the homepage of several websites;
1 www.baidu.com
Protocol version 1.1, the request was successful;
Date, time, GMT Format (GMT);
A content-type that indicates what MIME type the following document belongs to;
Content-type: [Type]/[subtype]; Parameter
The most common is text/html, the content returned is the text type, the text is HTML format. In principle, the browser will decide how to display the returned message body content according to Content-type.
Keep-alive
In the old HTTP version, each request will be created with a new client-to-server connection, send a request on this connection, and then receive the request. One of the great advantages of such a model is that it is simple, easy to understand and programmed to implement; it also has a big drawback that it is inefficient, so keep-alive is proposed to solve the problem of low efficiency.
The keep-alive feature makes the client-to-server connection persistent, and when a subsequent request to the server occurs, the Keep-alive feature avoids establishing or re-establishing the connection. Most Web servers on the market, including Iplanet, IIS, and Apache, support HTTP keep-alive. This feature is often useful for websites that provide static content. However, there is another problem with heavier sites: while retaining open connections for customers has some benefits, it also affects performance because the resources that could have been freed during the processing pause are still occupied. When the Web server and application server are running on the same machine, the Keep-alive feature has a particularly significant impact on resource utilization. This feature is a feature of HTTP 1.1 presets, and HTTP 1.0 plus Keep-aliveheader can also provide the persistent function of HTTP.
Specifying the "vary:accept-encoding" header, in a word, means "tell the proxy server to cache two versions of the resource: compressed and non-compressed, which helps to avoid the problem of some public proxies not being able to properly detect the content-encoding header." ”
Next is 6 Set-cookie;
Set-cookie is sent by the server, which is included in the header of the response request. It is used to create a cookie on the client.
EXPIRES=<DATE>: Sets the period of validity of the cookie, which expires if the cookie exceeds the date indicated by date.
Domain=<domain_name>:
Path=<some_path>:
Note: Temporary cookies (cookies without expires parameters) cannot be accompanied by the domain option.
When a client sends an HTTP request, a valid cookie is sent to the server along with it.
If the domain and path parameters of a cookie match the URL, the cookie is valid.
A URL contains domain and path, you can refer to the http://www.w3school.com.cn/html/html_url.asp
Secure: Indicates that the cookie can only be sent to the HTTP server.
HttpOnly: Indicates that the cookie cannot be obtained by client script.
That is, after opening the homepage of Baidu, there will be 6 cookies on your machine;
The cross-domain access cookie is implemented by setting the P3P header;
The Cache-control is used to control the HTTP cache (which may not be partially implemented in http/1.0, only Pragma:no-cache is implemented)
Format in a packet:
Cache-control:cache-directive
The cache-directive can be as follows:
The request is used:
| "No-cache"
| "No-store"
| "Max-age" "=" delta-seconds
| "Max-stale" ["=" delta-seconds]
| "Min-fresh" "=" delta-seconds
| "No-transform"
| "Only-if-cached"
| "Cache-extension"
Response when used:
| "Public"
| "Private" ["=" < "> Field-name <" >]
| "No-cache" ["=" < "> Field-name <" >]
| "No-store"
| "No-transform"
| "Must-revalidate"
| "Proxy-revalidate"
| "Max-age" "=" delta-seconds
| "S-maxage" "=" delta-seconds
| "Cache-extension"
Section Description:
Depending on whether the cache can be divided into
Public indicates that the response can be cached by any buffer.
Private indicates that the entire or partial response message for a single user cannot be shared with the cache. This allows the server to simply describe when the user's
Partial response message, this response message is not valid for another user's request.
No-cache indicates that the request or response message cannot be cached (http/1.0 replaced with pragma no-cache)
Based on what can be cached
No-store is used to prevent the inadvertent release of important information. Sending in the request message will make the request and response messages do not use the cache.
Based on cache timeout
Max-age indicates that the client can receive a response that is not longer than the specified time (in seconds).
Min-fresh indicates that the client can receive a response that is less than the current time plus a specified time.
Max-stale indicates that the client can receive a response message that exceeds the timeout period. If you specify a value for the Max-stale message, the client can
Receives a response message that is within the specified value of the timeout period.
Expires indicates the presence of time, allowing the client to not check (send the request) before this time, equivalent to Max-age
Effect. But if it exists at the same time, it is covered by Cache-control max-age.
Format:
Expires = "Expires" "": "Http-date
For example
Expires:thu, Dec 1994 16:00:00 GMT (must be in GMT format)
Cxy_all, not knowing what to do, looks like an encryption-related thing;
Cache-control,expires,x-powered-by, these three items belong to the cache control;
The server domain indicates that the response message was issued by the BWS server, and the version is 1.1
2 www. Csdn.net
Look at the CSDN, and Baidu has different;
Server:
Openresty is a high-performance Web platform based on Nginx and Lua, which integrates a large number of sophisticated Lua libraries, third-party modules, and most of the dependencies.
How do etag-last-modified and etags help improve performance?
Use the HTTP header of the last-modified and ETAGS requests to take advantage of the cache of the client (for example, the browser). Because the server first generates the LAST-MODIFIED/ETAG tag, the server can later use it to determine if the page has been modified. Essentially, the client requires the server to validate its (client) cache by passing the token back to the server.
The TCP connection is re-established after 20 seconds;
3 http://www.abchina.com/cn/(Agricultural Bank of China)
Server is IIS 7.5;
Create a cookie on the client;
Schematic HTTP protocol Header instance analysis