response_bank 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/response_bank/response_cache_handler.rb +9 -3
- data/lib/response_bank/version.rb +1 -1
- data/lib/response_bank.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14d74ea69a9a1c0eb4ff335172ac6b20f558faffbd3ae24dd6e93efcfd2a5384
|
4
|
+
data.tar.gz: e3cb5932250dae24d430c7db27b624da90057ddf92b3b2b51a5c3a98c6bc8e4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d784ab262b7643c9accc237eed90dd533492f5cb40b2b4b80d9e1a64b7ae244d5afc376a7e35adec4f0e5e8f7973339a9df432b8c7eae32fe8b785bd5c13ff4c
|
7
|
+
data.tar.gz: 99fd39c21b6323ca73d0d170ee991f6130982fea56654d12a9c76a4e62427e99bb026bb09462796e53be391a0634167fb4697a99c0dce2ab96381dd603949fcf
|
@@ -59,7 +59,7 @@ module ResponseBank
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def entity_tag
|
62
|
-
@entity_tag ||= ResponseBank.cache_key_for(key: @key_data, version: @version_data, key_schema_version: @key_schema_version)
|
62
|
+
@entity_tag ||= ResponseBank.cache_key_for(key: @key_data, version: @version_data, key_schema_version: @key_schema_version, encoding: @env['response_bank.server_cache_encoding'])
|
63
63
|
end
|
64
64
|
|
65
65
|
def cache_key
|
@@ -166,13 +166,19 @@ module ResponseBank
|
|
166
166
|
# If-None-Match: "abc"
|
167
167
|
# If-None-Match: W/"abc"
|
168
168
|
# If-None-Match: "abc", "def"
|
169
|
-
# If-None-Match:
|
169
|
+
# If-None-Match: *
|
170
170
|
return false unless entity_tag
|
171
171
|
return false unless if_none_match
|
172
172
|
|
173
|
+
return true if if_none_match == "*"
|
174
|
+
|
173
175
|
# strictly speaking an unquoted etag is not valid, yet common
|
174
176
|
# to avoid unintended greedy matches in we check for naked entity then includes with quoted entity values
|
175
|
-
|
177
|
+
entity_tag = %{"#{entity_tag}"} unless entity_tag.starts_with?('"')
|
178
|
+
|
179
|
+
if_none_match = %{"#{if_none_match}"} unless if_none_match.starts_with?('"') || if_none_match.starts_with?('W/"')
|
180
|
+
|
181
|
+
if_none_match == entity_tag || if_none_match.include?(entity_tag)
|
176
182
|
end
|
177
183
|
|
178
184
|
def stale_while_revalidate?(timestamp, cache_age_tolerance)
|
data/lib/response_bank.rb
CHANGED
@@ -30,7 +30,7 @@ module ResponseBank
|
|
30
30
|
backing_cache_store.read(cache_key, raw: true)
|
31
31
|
end
|
32
32
|
|
33
|
-
def compress(content, encoding = "
|
33
|
+
def compress(content, encoding = "br")
|
34
34
|
case encoding
|
35
35
|
when 'gzip'
|
36
36
|
Zlib.gzip(content, level: Zlib::BEST_COMPRESSION)
|
@@ -41,7 +41,7 @@ module ResponseBank
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def decompress(content, encoding = "
|
44
|
+
def decompress(content, encoding = "br")
|
45
45
|
case encoding
|
46
46
|
when 'gzip'
|
47
47
|
Zlib.gunzip(content)
|