cache_rules 0.1.19 → 0.1.20

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ # 0.1.20 (2015-05-01)
4
+
5
+ * Recently cached responses are cached correctly. Fixes issue #11
6
+
3
7
  # 0.1.19 (2015-05-01)
4
8
 
5
9
  * The 'max-stale' header doesn't affect 'max-age' validation
data/cache_rules.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'date'
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = 'cache_rules'
9
- s.version = '0.1.19'
9
+ s.version = '0.1.20'
10
10
 
11
11
  s.date = Date.today.to_s
12
12
 
data/lib/helpers.rb CHANGED
@@ -295,7 +295,7 @@ module CacheRules
295
295
 
296
296
  # Don't cache heuristic responses more than 24 hours old, and avoid sending a 113 Warning ;)
297
297
  # source: https://tools.ietf.org/html/rfc7234#section-4.2.2
298
- current_age > 86400 ? 0 : result
298
+ current_age > 86400 ? 0 : (now + result)
299
299
  else
300
300
  0
301
301
  end
data/test/test_helpers.rb CHANGED
@@ -362,7 +362,7 @@ class TestHelpers < MiniTest::Test
362
362
  too_old = CacheRules.helper_heuristic now, @cached_headers, 86401
363
363
  noop = CacheRules.helper_heuristic(now, {}, 42)
364
364
 
365
- assert_equal last_modified, 16560
365
+ assert_equal last_modified, 1420378785
366
366
  assert_equal not_public, 0
367
367
  assert_equal too_old, 0
368
368
  assert_equal noop, 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cache_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: