HTTP Date标头背后的理由是什么? [英] What's the rationale behind the HTTP Date header?
问题描述
我已阅读 RFC 2616 ,但仍然我不知道,Date字段是什么。最后修改的字段,除了仅仅提供元数据,即缓存(If-Modified-Since)之外,其实还有一个意义。
I have read RFC 2616, but still I wonder, what the Date field is for. There is the Last-Modified field, that actually has a meaning besides just serving metadata, that is, for caching ('If-Modified-Since').
但是使用它在单独的日期标题中将信息加倍?
But what use has it to double the info in a separate Date header?
推荐答案
Per 规格,它用于年龄计算。如果您不知道服务器什么时候认为是这样,您将无法计算资源的年龄。以下是规范的相关文本:
Per the spec, it is used in age calculations. If you don't know what time the server thinks it is, you won't be able to calculate the "age" of a resource. Here's the relevant text from the spec:
当缓存收到响应时,年龄计算算法摘要:
Summary of age calculation algorithm, when a cache receives a response:
age_value
是由$ b缓存接收的Age: $ b此回复。
age_value
is the value of Age: header received by the cache with
this response.
date_value
是原始服务器的价值日期:
标题
request_time
是当缓存提出请求
导致缓存响应的(本地)时间
request_time
is the (local) time when the cache made the request
that resulted in this cached response
response_time
是缓存收到
响应的(本地)时间
response_time
is the (local) time when the cache received the
response
现在
是当前(本地)时间
now
is the current (local) time
apparent_age = max(0, response_time - date_value);
corrected_received_age = max(apparent_age, age_value);
response_delay = response_time - request_time;
corrected_initial_age = corrected_received_age + response_delay;
resident_time = now - response_time;
current_age = corrected_initial_age + resident_time;
这篇关于HTTP Date标头背后的理由是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!