请澄清这个由 IE9 传递的奇怪的 If-Modified-Since
header
在我的 ASP.NET 4.0 网络应用程序中,我有一个通用处理程序 (.ashx),用于处理存储在数据库中的图像。为了提高效率,我正在处理一些与缓存相关的 header 并传递缓存信息。
我在尝试解析 If-Modified-Since
header 内容时经常遇到 DateTime 解析错误,通常来自 IE9。原来它发送的是这样的东西:
Mon, 28 Nov 2011 16:34:52 GMT; length=8799
我通过使用正则表达式去除最后一部分来处理这个问题。但我很好奇:它指的是什么长度,它有什么用?它是请求的 URL 的缓存数据的大小吗?
最佳答案
根据 old post在 Squid 代理邮件列表上:
The length parameter to If-Modified-Since is a Netscape extension of HTTP/1.0, meant to improve the accuracy of If-Modified-Since in case a document is updated twice in the same second.
HTTP/1.1 solved the same problem in a better way via the ETag header and If-None-Match.
我猜 IE 在某个时候调整了这个扩展并将其保留在里面。
关于asp.net - If-Modified-Since IE9 传递的 HTTP header 包含长度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12626699/