In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
The main content of this article is "will the response change when ETag changes?", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "will the response change when the ETag changes?"
Not necessarily, it is determined by the ETag generation algorithm in the server. Do you know how the ETag in the http response header is generated?
For example, etag in nginx is composed of last_modified and content_length, while last_modified is made up of mtime.
When you edit a file without changing the contents of the file, the mtime also changes, and the etag changes, but the contents of the file remain unchanged.
What is the basis for generating the Last-Modified of static files in http services
The mtime of the file is generally selected to indicate the modification time of the file content.
Nginx is also handled in this way. For source code, please see ngx_http_static_module.c [1].
R-> headers_out.status = NGX_HTTP_OK
R-> headers_out.content_length_n = of.size
R-> headers_out.last_modified_time = of.mtime
Then why use mtime instead of ctime?
What do mtime and ctime refer to in the file system, and what are the differences
In linux
Mtime: modified time refers to the timestamp of the change of file content ctime: change time refers to the timestamp of the change of file attributes, including mtime. On windows, it means creation time.
So ctime will be a little larger than mtime. Use stat to view the file properties as follows
$stat hello.txt
File: 'hello.txt'
Size: 30 Blocks: 8 IO Block: 4096 regular file
Device: fd01h/64769d Inode: 917526 Links: 1
Access: (0644) Uid: (0 / root) Gid: (0 / root)
Access: 2019-12-10 16 purl 15purl 55.253325208 + 0800
Modify: 2019-12-10 16-15-15-52.740653330 + 0800
Change: 2019-12-10 16 purl 15purl 52.742653069 + 0800
Birth:-
When http services choose Last_Modified, they usually choose mtime.
At this point, I believe you have a deeper understanding of "will the response change when the ETag changes?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.