Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit 7545c40

Browse files
committed
Ensure Cache-Control is verified
1 parent 24094d3 commit 7545c40

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.1.14 (2015-04-28)
4+
5+
* Ensure Cache-Control is verified
6+
37
## 0.1.13 (2015-04-28)
48

59
* Don't cache the Host header

cache_rules.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require 'date'
66

77
Gem::Specification.new do |s|
88
s.name = 'cache_rules'
9-
s.version = '0.1.13'
9+
s.version = '0.1.14'
1010

1111
s.date = Date.today.to_s
1212

lib/validations.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,13 @@ def validate_no_cache?(headers)
9090

9191
# source: https://tools.ietf.org/html/rfc7234#section-5.2.2.2
9292
# source: https://tools.ietf.org/html/rfc7234#section-3.2
93-
return 1 if (( cached = cached_headers['Cache-Control'] )) &&
94-
helper_no_cache.call(cached_headers) ||
95-
(cached['no-cache'] && cached['no-cache']['quoted_string'].nil?) ||
96-
(cached['s-maxage'] && cached['s-maxage']['token'].to_s == "0") ||
97-
(cached['max-age'] && cached['max-age']['token'].to_s == "0")
93+
if cached_headers['Cache-Control']
94+
return 1 if (( cached = cached_headers['Cache-Control'] )) &&
95+
helper_no_cache.call(cached_headers) ||
96+
(cached['no-cache'] && cached['no-cache']['quoted_string'].nil?) ||
97+
(cached['s-maxage'] && cached['s-maxage']['token'].to_s == "0") ||
98+
(cached['max-age'] && cached['max-age']['token'].to_s == "0")
99+
end
98100

99101
# source: https://tools.ietf.org/html/rfc7234#section-5.4
100102
# Legacy support for HTTP/1.0 Pragma header

0 commit comments

Comments
 (0)