http 标头中的 Last-Modified
我请求一个网站标头,但是,此 http 标头中没有“Last-Modified”信息。我想创建一个站点地图并获取服务器上每个文件的日期。不明白为什么有些网站没有此信息。某些软件(例如 Xenu)如何获取文件的日期。
I request a website header, however, there is not Last-Modified info in this http header. I wanna creat a site map and get each file's date on the server. Don't understand why there is not this info for some websites. How did some softwares, such as Xenu, get the file's date.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 Johannes Rössel 在对您的问题的评论中指出的那样,Last-Modified 标头不是强制性的。如果存在,您可以像任何其他 HTTP 标头一样读取它(确切的方法取决于您的确切代码,因此在出现代码之前我们无法透露更多信息)。如果不存在,您将无法读取它。就这么简单。除非远程服务器提供此类信息,否则您无法获取有关远程资源的信息。这对于 HTTP 和大多数其他网络协议都有效。
As Johannes Rössel points in his comment to your question, the Last-Modified header is not compulsory. If it is there, you can read it just like any other HTTP header (the exact method depends on your exact code so we can't say more until there's code). If it isn't there, you can't read it. It's as simple as that. You can't fetch information about remote resources unless the remote server provides such piece of info. That's valid for HTTP and most other network protocols.