rack-s3 0.0.3 → 0.0.4
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.
- data/Gemfile.lock +3 -3
- data/lib/rack/s3.rb +3 -3
- data/lib/rack/s3/version.rb +1 -1
- data/test/rack_s3_test.rb +12 -2
- data/test/vcr_cassettes/key_with_spaces.yml +94 -0
- metadata +6 -4
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rack-s3 (0.0.
|
4
|
+
rack-s3 (0.0.4)
|
5
5
|
aws-s3
|
6
6
|
rack
|
7
7
|
|
@@ -18,11 +18,11 @@ GEM
|
|
18
18
|
mime-types (1.16)
|
19
19
|
rack (1.2.1)
|
20
20
|
shoulda (2.11.3)
|
21
|
-
vcr (1.5.
|
21
|
+
vcr (1.5.1)
|
22
22
|
webmock (1.6.2)
|
23
23
|
addressable (>= 2.2.2)
|
24
24
|
crack (>= 0.1.7)
|
25
|
-
xml-simple (1.0.
|
25
|
+
xml-simple (1.0.14)
|
26
26
|
|
27
27
|
PLATFORMS
|
28
28
|
ruby
|
data/lib/rack/s3.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rack'
|
2
2
|
require 'aws/s3'
|
3
|
+
require 'cgi'
|
3
4
|
|
4
5
|
module Rack
|
5
6
|
class S3
|
@@ -36,13 +37,12 @@ module Rack
|
|
36
37
|
{ 'Content-Type' => about['content-type'],
|
37
38
|
'Content-Length' => about['content-length'],
|
38
39
|
'Etag' => about['etag'],
|
39
|
-
'Last-Modified' => about['last-modified']
|
40
|
-
'Cache-Control' => 'public; max-age=2592000' # cache image for a month
|
40
|
+
'Last-Modified' => about['last-modified']
|
41
41
|
}
|
42
42
|
end
|
43
43
|
|
44
44
|
def path_info
|
45
|
-
@env['PATH_INFO']
|
45
|
+
CGI.unescape @env['PATH_INFO']
|
46
46
|
end
|
47
47
|
|
48
48
|
def path
|
data/lib/rack/s3/version.rb
CHANGED
data/test/rack_s3_test.rb
CHANGED
@@ -42,7 +42,6 @@ class RackS3Test < Test::Unit::TestCase
|
|
42
42
|
|
43
43
|
should 'render the file' do
|
44
44
|
assert_equal 200, subject.status
|
45
|
-
assert_equal 'public; max-age=2592000', subject.headers['Cache-Control']
|
46
45
|
assert_not_nil subject.body
|
47
46
|
|
48
47
|
%w(Content-Type Last-Modified Last-Modified Etag).each do |header|
|
@@ -60,7 +59,6 @@ class RackS3Test < Test::Unit::TestCase
|
|
60
59
|
|
61
60
|
should 'render the file' do
|
62
61
|
assert_equal 200, subject.status
|
63
|
-
assert_equal 'public; max-age=2592000', subject.headers['Cache-Control']
|
64
62
|
assert_not_nil subject.body
|
65
63
|
|
66
64
|
%w(Content-Type Last-Modified Last-Modified Etag).each do |header|
|
@@ -69,6 +67,18 @@ class RackS3Test < Test::Unit::TestCase
|
|
69
67
|
end
|
70
68
|
end
|
71
69
|
|
70
|
+
context 'A request for a key containing spaces' do
|
71
|
+
subject do
|
72
|
+
VCR.use_cassette 'key_with_spaces' do
|
73
|
+
mock_request '/key%20with%20spaces.png'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
should 'render the file' do
|
78
|
+
assert_equal 200, subject.status
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
72
82
|
context 'A request to a mapped app' do
|
73
83
|
subject do
|
74
84
|
VCR.use_cassette 'clear' do
|
@@ -0,0 +1,94 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: http://s3.amazonaws.com:80/rack-s3?marker=key%20with%20spaces.pnf&max-keys=1
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 200
|
11
|
+
message: OK
|
12
|
+
headers:
|
13
|
+
x-amz-id-2:
|
14
|
+
- pOjjAQ3Dsd3tKoFG9Hg0tK81Incbd243yIOLFMGsI5NBIvshC/drTCXkvhjEM9Iq
|
15
|
+
content-type:
|
16
|
+
- application/xml
|
17
|
+
server:
|
18
|
+
- AmazonS3
|
19
|
+
date:
|
20
|
+
- Fri, 28 Jan 2011 15:54:02 GMT
|
21
|
+
x-amz-request-id:
|
22
|
+
- C8D0513081C9FC43
|
23
|
+
transfer-encoding:
|
24
|
+
- chunked
|
25
|
+
body: |-
|
26
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
27
|
+
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>rack-s3</Name><Prefix></Prefix><Marker>key with spaces.pnf</Marker><MaxKeys>1</MaxKeys><IsTruncated>true</IsTruncated><Contents><Key>key with spaces.png</Key><LastModified>2011-01-28T15:44:27.000Z</LastModified><ETag>"71a50dbba44c78128b221b7df7bb51f1"</ETag><Size>95</Size><Owner><ID>abc123</ID><DisplayName>rack-s3</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListBucketResult>
|
28
|
+
http_version: "1.1"
|
29
|
+
- !ruby/struct:VCR::HTTPInteraction
|
30
|
+
request: !ruby/struct:VCR::Request
|
31
|
+
method: :head
|
32
|
+
uri: http://s3.amazonaws.com:80/rack-s3/key%20with%20spaces.png
|
33
|
+
body:
|
34
|
+
headers:
|
35
|
+
response: !ruby/struct:VCR::Response
|
36
|
+
status: !ruby/struct:VCR::ResponseStatus
|
37
|
+
code: 200
|
38
|
+
message: OK
|
39
|
+
headers:
|
40
|
+
etag:
|
41
|
+
- "\"71a50dbba44c78128b221b7df7bb51f1\""
|
42
|
+
last-modified:
|
43
|
+
- Fri, 28 Jan 2011 15:44:27 GMT
|
44
|
+
x-amz-id-2:
|
45
|
+
- o6jvTK19hfPEaaUW22trSeS3+PB6FezxvxkQCWSpGmIO3lu/wtkPY1yyX3Ao7QGT
|
46
|
+
content-type:
|
47
|
+
- image/png
|
48
|
+
server:
|
49
|
+
- AmazonS3
|
50
|
+
date:
|
51
|
+
- Fri, 28 Jan 2011 15:54:03 GMT
|
52
|
+
content-length:
|
53
|
+
- "95"
|
54
|
+
x-amz-request-id:
|
55
|
+
- 9DB4B86707E5AD05
|
56
|
+
accept-ranges:
|
57
|
+
- bytes
|
58
|
+
body:
|
59
|
+
http_version: "1.1"
|
60
|
+
- !ruby/struct:VCR::HTTPInteraction
|
61
|
+
request: !ruby/struct:VCR::Request
|
62
|
+
method: :get
|
63
|
+
uri: http://s3.amazonaws.com:80/rack-s3/key%20with%20spaces.png
|
64
|
+
body:
|
65
|
+
headers:
|
66
|
+
response: !ruby/struct:VCR::Response
|
67
|
+
status: !ruby/struct:VCR::ResponseStatus
|
68
|
+
code: 200
|
69
|
+
message: OK
|
70
|
+
headers:
|
71
|
+
etag:
|
72
|
+
- "\"71a50dbba44c78128b221b7df7bb51f1\""
|
73
|
+
last-modified:
|
74
|
+
- Fri, 28 Jan 2011 15:44:27 GMT
|
75
|
+
x-amz-id-2:
|
76
|
+
- e21vM8iCkWJlB3vRiaG2V9uXWC5fJEmqPCChC0XvwwfOagz8NGjeUMEM7IW24r+c
|
77
|
+
content-type:
|
78
|
+
- image/png
|
79
|
+
server:
|
80
|
+
- AmazonS3
|
81
|
+
date:
|
82
|
+
- Fri, 28 Jan 2011 15:54:03 GMT
|
83
|
+
content-length:
|
84
|
+
- "95"
|
85
|
+
x-amz-request-id:
|
86
|
+
- E5EF8520D4E7D879
|
87
|
+
accept-ranges:
|
88
|
+
- bytes
|
89
|
+
body: !binary |
|
90
|
+
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACn
|
91
|
+
ej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVO
|
92
|
+
RK5CYII=
|
93
|
+
|
94
|
+
http_version: "1.1"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Larry Marburger
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-28 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- test/rack_s3_test.rb
|
111
111
|
- test/test_helper.rb
|
112
112
|
- test/vcr_cassettes/clear.yml
|
113
|
+
- test/vcr_cassettes/key_with_spaces.yml
|
113
114
|
- test/vcr_cassettes/nested_clear.yml
|
114
115
|
- test/vcr_cassettes/not_found.yml
|
115
116
|
has_rdoc: true
|
@@ -150,5 +151,6 @@ test_files:
|
|
150
151
|
- test/rack_s3_test.rb
|
151
152
|
- test/test_helper.rb
|
152
153
|
- test/vcr_cassettes/clear.yml
|
154
|
+
- test/vcr_cassettes/key_with_spaces.yml
|
153
155
|
- test/vcr_cassettes/nested_clear.yml
|
154
156
|
- test/vcr_cassettes/not_found.yml
|