rack-cache 1.4.2 → 1.4.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/CHANGES +4 -0
- data/lib/rack/cache/context.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b8c0717cec69415537569ff314785477abb57fa
|
4
|
+
data.tar.gz: 46986ca62b90b9824014895ad532f418c57e052d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 258bb98c7d13c4d64f9e200ceec7a6d1c3c619c7691c2e85dcca029a9d2fb378f488d9901fa55ebd625c29e09bb76f783eae5f9bc11fd407899353751dfbbdca
|
7
|
+
data.tar.gz: ccf41967f25622f90f17634771ead0692e8e44525dd8328fa5762917808ca078ccb8274ccf33987b4fb04a29f96f30547a89e3805548b2bbfd414e3736e3669d
|
data/CHANGES
CHANGED
data/lib/rack/cache/context.rb
CHANGED
@@ -195,7 +195,7 @@ module Rack::Cache
|
|
195
195
|
# as a template for a conditional GET request with the backend.
|
196
196
|
def validate(entry)
|
197
197
|
# send no head requests because we want content
|
198
|
-
|
198
|
+
convert_head_to_get!
|
199
199
|
|
200
200
|
# add our cached last-modified validator to the environment
|
201
201
|
@env['HTTP_IF_MODIFIED_SINCE'] = entry.last_modified
|
@@ -244,7 +244,7 @@ module Rack::Cache
|
|
244
244
|
# caching of the response when the backend returns a 304.
|
245
245
|
def fetch
|
246
246
|
# send no head requests because we want content
|
247
|
-
|
247
|
+
convert_head_to_get!
|
248
248
|
|
249
249
|
response = forward
|
250
250
|
|
@@ -299,5 +299,13 @@ module Rack::Cache
|
|
299
299
|
@env['rack.errors'].write(message)
|
300
300
|
end
|
301
301
|
end
|
302
|
+
|
303
|
+
# send no head requests because we want content
|
304
|
+
def convert_head_to_get!
|
305
|
+
if @env['REQUEST_METHOD'] == 'HEAD'
|
306
|
+
@env['REQUEST_METHOD'] = 'GET'
|
307
|
+
@env['rack.methodoverride.original_method'] = 'HEAD'
|
308
|
+
end
|
309
|
+
end
|
302
310
|
end
|
303
311
|
end
|