Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Q116】http 服务中静态文件的 Last-Modified 是根据什么生成的 #117

Open
shfshanyue opened this issue Dec 10, 2019 · 2 comments
Labels

Comments

@shfshanyue
Copy link
Owner

No description provided.

@shfshanyue
Copy link
Owner Author

shfshanyue commented Dec 10, 2019

一般会选文件的 mtime,表示文件内容的修改时间

nginx 也是这样处理的,源码见: ngx_http_static_module.c

    r->headers_out.status = NGX_HTTP_OK;
    r->headers_out.content_length_n = of.size;
    r->headers_out.last_modified_time = of.mtime;

关于为什么使用 mtime 而非 ctime,可以参考 #116

@feefeefee
Copy link

针对静态资源而言,一般会选择文件的 mtime 元属性作为上次修改时间,该元属性表示文件内容的修改时间,在linux中可以用stat命令来查看文件属性,其中就包括了mtime和ctime。mtime指的是文件内容修改时间,而ctime指的是文件修改时间

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants