@@ -68,7 +68,7 @@ def helper_response(url, actions, column, cached, response = {})
6868 headers_304 = helper_headers_200_304 . call ( cached , normalized ) if status == 200 || status == 304
6969 headers_url = { 'Location' => url } if status == 307
7070
71- headers = [ age , warning , x_cache , headers_304 , headers_url ] . compact . reduce &:merge
71+ headers = [ headers_304 , age , warning , x_cache , headers_url ] . compact . reduce &:merge
7272
7373 { :body => body , :code => status , :headers => headers }
7474 end
@@ -249,7 +249,7 @@ def helper_current_age(now, cached)
249249 date_value = cached [ 'Date' ] [ 'timestamp' ] # Required
250250 request_time = cached [ 'X-Cache-Req-Date' ] [ 'timestamp' ] # Required
251251 response_time = cached [ 'X-Cache-Res-Date' ] [ 'timestamp' ] # Required
252- age_value = cached [ 'Age' ] . nil? ? 0 : cached [ 'Age' ] [ 'timestamp' ] . to_i
252+ age_value = cached [ 'Age' ] . nil? ? 0 : cached [ 'Age' ] . to_i
253253
254254 apparent_age = helper_apparent_age response_time , date_value
255255 corrected_age_value = helper_corrected_age_value response_time , request_time , age_value
@@ -285,12 +285,12 @@ def helper_explicit(cached_headers)
285285 return ( cached_headers [ 'Expires' ] [ 'timestamp' ] - cached_headers [ 'Date' ] [ 'timestamp' ] ) if cached_headers [ 'Expires' ]
286286 end
287287
288- # Calculate Heuristic Freshness if there's not explicit expiration time
288+ # Calculate Heuristic Freshness if there's no explicit expiration time
289289 # source: https://tools.ietf.org/html/rfc7234#section-4.2.2
290290 def helper_heuristic ( now , cached , current_age )
291- # Use 10% only if the response is public and there's a Last-Modified header
291+ # Use 10% only if there's a Last-Modified header
292292 # source: https://tools.ietf.org/html/rfc7234#section-4.2.2
293- if cached [ 'Cache-Control' ] && cached [ 'Cache-Control' ] [ 'public' ] && cached [ ' Last-Modified']
293+ if cached [ 'Last-Modified' ]
294294 result = ( now - cached [ 'Last-Modified' ] [ 'timestamp' ] ) / 10
295295
296296 # Don't cache heuristic responses more than 24 hours old, and avoid sending a 113 Warning ;)
0 commit comments