http://www.cnblogs.com/hust-ghtao/: Hua ke xiao Tao:
The previous time to participate in a company's interview, asked me etag field, when said is not very clear, found some information, collation for this article.
simple ETag is similar to the fingerprint of a resource entity, and they can be quickly compared to determine whether the two versions of the resource are the same . The ETag comparison is only meaningful for the same URL-the ETag values of resources on different URLs may or may not be the same, and they cannot be inferred from the comparison of their etag.
The header field ETag can tell the client entity identity. It is a way to uniquely identify a resource as a string. The server assigns a corresponding ETag value for each resource, and the ETag value needs to be updated when the resource is updated. Common methods for generating an etag include using the anti-collision hash function on the resource content, using the hash of the recently modified timestamp, or even just a version number.
In a typical usage, when a URL is requested, the Web server returns the resource and its corresponding ETag value, which is placed in the "ETag" field of http:
1:"686897696a7c876b7e"
The client can then decide whether to cache the resource and its etag. Later, if the client wants to request the same URL again, it will send a request containing the saved ETag and the "If-none-match" field.
1:"686897696a7c876b7e"
After a client request, the server may compare the etag of the client and the ETag of the current version of the resource. If the ETag value matches, which means that the resource has not changed, the server sends back a very short response that contains the HTTP "304 unmodified" state. The 304 status tells the client that its cached version is up-to-date and should use it.
However, if the value of the ETag does not match, which means that the resource is likely to change, then a complete response is returned, including the contents of the resource, as if the etag was not being used. In this case, the client can replace the previous cached version with the newly returned resource and the new ETag.
The ETag field of the HTTP protocol