response_bank 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/response_bank/middleware.rb +1 -2
- data/lib/response_bank/response_cache_handler.rb +8 -5
- data/lib/response_bank/version.rb +1 -1
- data/lib/response_bank.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87b964dde00b2a9aa0b319430185a6cfefa8d40323b634556cf1298c8e2ee1a9
|
4
|
+
data.tar.gz: 16b9d49921f037bec53031f145e44815a820de2ec93992a6d6c4926cb22b2f95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f95e92a493db39dd4cb3dc43dd5582d19e64a9857f3304420152ae235088f1d1101cc480d112c9f49346c08e168eaaf881e351061f0ac17d6676a452ca4dc06
|
7
|
+
data.tar.gz: b77dfa70dc32d45153c2177e9e5c4762a881d7bd998479b8a209121b903ef9d3f323335ebba7aeb6bbfab381fd5fbddc2f861ddf19145e606348d8b5b00a60e7
|
@@ -22,8 +22,7 @@ module ResponseBank
|
|
22
22
|
|
23
23
|
if env['cacheable.cache']
|
24
24
|
if [200, 404, 301, 304].include?(status)
|
25
|
-
headers['ETag'] = env['cacheable.key']
|
26
|
-
|
25
|
+
headers['ETag'] = %{"#{env['cacheable.key']}"}
|
27
26
|
end
|
28
27
|
|
29
28
|
if [200, 404, 301].include?(status) && env['cacheable.miss']
|
@@ -145,11 +145,14 @@ module ResponseBank
|
|
145
145
|
# regen
|
146
146
|
@headers.merge!(headers)
|
147
147
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
148
|
+
if @headers['Content-Encoding']
|
149
|
+
if !@env['HTTP_ACCEPT_ENCODING'].to_s.include?(@headers['Content-Encoding'])
|
150
|
+
ResponseBank.log("uncompressing payload for client as client doesn't require encoding")
|
151
|
+
body = ResponseBank.decompress(body, @headers['Content-Encoding'])
|
152
|
+
@headers.delete('Content-Encoding')
|
153
|
+
end
|
154
|
+
else
|
155
|
+
ResponseBank.log("Cache hit, but missing content-encoding in the cache value headers, maybe because of 301 or 404 response or empty body string")
|
153
156
|
end
|
154
157
|
|
155
158
|
[status, @headers, [body]]
|
data/lib/response_bank.rb
CHANGED
@@ -64,7 +64,7 @@ module ResponseBank
|
|
64
64
|
key = %{#{key}:#{hash_value_str(data[:version])}} if data[:version]
|
65
65
|
|
66
66
|
# add the encoding to only the cache key but don't expose this detail in the entity_tag
|
67
|
-
key = %{#{key}:#{hash_value_str(data[:encoding])}} if data[:encoding]
|
67
|
+
key = %{#{key}:#{hash_value_str(data[:encoding])}} if data[:encoding]
|
68
68
|
|
69
69
|
key
|
70
70
|
when Array
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: response_bank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Lütke
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-04-
|
12
|
+
date: 2023-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|