1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[fix] Corrected the service mocks for testing to respond with a 304 to values of If-Modified-Since that match Last-Modified

The HTTP spec suggests that clients supply the value of Last-Modified that they previously received from the server to If-Modified-Since. When comparing If-Modified-Since > Last-Modified, however, the Mock object would fail to return a 304 for such a case.
This commit is contained in:
Bob Lail and Luke Booth 2013-07-10 13:58:54 -05:00
parent a23d615ad5
commit 47547e42ef
4 changed files with 4 additions and 4 deletions

View file

@ -87,7 +87,7 @@ module Fog
if (object && !object[:delete_marker])
if options['If-Match'] && options['If-Match'] != object['ETag']
response.status = 412
elsif options['If-Modified-Since'] && options['If-Modified-Since'] > Time.parse(object['Last-Modified'])
elsif options['If-Modified-Since'] && options['If-Modified-Since'] >= Time.parse(object['Last-Modified'])
response.status = 304
elsif options['If-None-Match'] && options['If-None-Match'] == object['ETag']
response.status = 304

View file

@ -73,7 +73,7 @@ module Fog
if (bucket = self.data[:buckets][bucket_name]) && (object = bucket[:objects][object_name])
if options['If-Match'] && options['If-Match'] != object['ETag']
response.status = 412
elsif options['If-Modified-Since'] && options['If-Modified-Since'] > Time.parse(object['Last-Modified'])
elsif options['If-Modified-Since'] && options['If-Modified-Since'] >= Time.parse(object['Last-Modified'])
response.status = 304
elsif options['If-None-Match'] && options['If-None-Match'] == object['ETag']
response.status = 304

View file

@ -43,7 +43,7 @@ module Fog
if (object = container[:objects][object_name])
if options['If-Match'] && options['If-Match'] != object['ETag']
response.status = 412
elsif options['If-Modified-Since'] && options['If-Modified-Since'] > Time.parse(object['Last-Modified'])
elsif options['If-Modified-Since'] && options['If-Modified-Since'] >= Time.parse(object['Last-Modified'])
response.status = 304
elsif options['If-None-Match'] && options['If-None-Match'] == object['ETag']
response.status = 304

View file

@ -78,7 +78,7 @@ module Fog
if (object && !object[:delete_marker])
if options['If-Match'] && options['If-Match'] != object['ETag']
response.status = 412
elsif options['If-Modified-Since'] && options['If-Modified-Since'] > Time.parse(object['Last-Modified'])
elsif options['If-Modified-Since'] && options['If-Modified-Since'] >= Time.parse(object['Last-Modified'])
response.status = 304
elsif options['If-None-Match'] && options['If-None-Match'] == object['ETag']
response.status = 304