rack-cache 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +4 -0
  3. data/lib/rack/cache/context.rb +10 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6532f8a00a3de52c0271c2524286ace2a344f75
4
- data.tar.gz: 611a3881d190a0a60d40e412781a5fb0b55258ec
3
+ metadata.gz: 3b8c0717cec69415537569ff314785477abb57fa
4
+ data.tar.gz: 46986ca62b90b9824014895ad532f418c57e052d
5
5
  SHA512:
6
- metadata.gz: a48fa28f5b3e6808530f823359babb24df80c92cfd5c94531f7a9a5daebf53f7f18f133dda1a4d32a0c673fe5cc9e682920ec0f1e78d7be11d72070873e174f2
7
- data.tar.gz: 858c81e37258eb87095bbeb0c9a961a52e46dc9b7f41b76bc574fb9bfc5cb821c7078ccff1bbf3956083eafb01e09bcdb9024955e2d2274f967f5c4bed1cc42f
6
+ metadata.gz: 258bb98c7d13c4d64f9e200ceec7a6d1c3c619c7691c2e85dcca029a9d2fb378f488d9901fa55ebd625c29e09bb76f783eae5f9bc11fd407899353751dfbbdca
7
+ data.tar.gz: ccf41967f25622f90f17634771ead0692e8e44525dd8328fa5762917808ca078ccb8274ccf33987b4fb04a29f96f30547a89e3805548b2bbfd414e3736e3669d
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.4.3
2
+
3
+ * After overriding the REQUEST_METHOD, store the original request method in "rack.methodoverride.original_method"
4
+
1
5
  ## 1.4.1
2
6
 
3
7
  * Ignore invalid Expires date as per RFC
@@ -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
- @env['REQUEST_METHOD'] = 'GET'
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
- @env['REQUEST_METHOD'] = 'GET'
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tomayko