5.2.1.3. min-fresh

2 阅读1分钟

5.2.1.3. min-fresh

rfc 7234 5.2.1.3. min-fresh

 Argument syntax:
 
      delta-seconds (see Section 1.2.1)
      
   The "min-fresh" request directive indicates that the client is
   willing to accept a response whose freshness lifetime is no less than
   its current age plus the specified time in seconds.  That is, the
   client wants a response that will still be fresh for at least the
   specified number of seconds.

   This directive uses the token form of the argument syntax: e.g.,
   'min-fresh=20' not 'min-fresh="20"'.  A sender SHOULD NOT generate
   the quoted-string form.

解释

"min-fresh" request directive表示,client期望收到response:

当cache在处理min-fresh时,这个response满足:

Freshness Lifetime >= Current Age + min-fresh

注意:

Current Age为cache处理min-fresh时计算的response的age

不考虑response time

client可以做出认为:

收到的response至少还有min-fresh秒以后才过期

考虑response time

(以下讨论在所有时间都正确同步的情况下进行)

-------------Lifetime-------------------------|      

current age                  
-----|---------------min-fresh-------------|
     
// A:     
-----|------response interval---|
                                |---delta--| 

// B:                            
-----|--------response interval------------|

// C:                            
-----|--------------response interval------------|
                                                     
                                                     
current age + min-fresh - response time == delta                                                                    

A/B:

如果delta >= 0,则表示client收到的response还有delta时间过期

C:

如果delta < 0 ,response失去了min-fresh的保护,则client需要通过对比response time 和 response真正的过期时间。然而client并不知道 如何计算真正的过期时间,所以在这种情况下,client没法做出正确的认为。