rack 1.6.13 → 2.1.4.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +92 -0
- data/{COPYING → MIT-LICENSE} +4 -2
- data/README.rdoc +105 -141
- data/Rakefile +27 -28
- data/SPEC +6 -7
- data/bin/rackup +1 -0
- data/contrib/rack_logo.svg +164 -111
- data/example/lobster.ru +2 -0
- data/example/protectedlobster.rb +4 -2
- data/example/protectedlobster.ru +3 -1
- data/lib/rack/auth/abstract/handler.rb +3 -1
- data/lib/rack/auth/abstract/request.rb +7 -1
- data/lib/rack/auth/basic.rb +4 -1
- data/lib/rack/auth/digest/md5.rb +9 -7
- data/lib/rack/auth/digest/nonce.rb +6 -3
- data/lib/rack/auth/digest/params.rb +5 -4
- data/lib/rack/auth/digest/request.rb +3 -1
- data/lib/rack/body_proxy.rb +11 -9
- data/lib/rack/builder.rb +42 -18
- data/lib/rack/cascade.rb +6 -5
- data/lib/rack/chunked.rb +33 -10
- data/lib/rack/{commonlogger.rb → common_logger.rb} +14 -10
- data/lib/rack/{conditionalget.rb → conditional_get.rb} +3 -1
- data/lib/rack/config.rb +2 -0
- data/lib/rack/content_length.rb +5 -3
- data/lib/rack/content_type.rb +3 -1
- data/lib/rack/core_ext/regexp.rb +14 -0
- data/lib/rack/deflater.rb +33 -53
- data/lib/rack/directory.rb +75 -60
- data/lib/rack/etag.rb +8 -5
- data/lib/rack/events.rb +156 -0
- data/lib/rack/file.rb +4 -149
- data/lib/rack/files.rb +178 -0
- data/lib/rack/handler/cgi.rb +18 -17
- data/lib/rack/handler/fastcgi.rb +17 -16
- data/lib/rack/handler/lsws.rb +14 -12
- data/lib/rack/handler/scgi.rb +22 -19
- data/lib/rack/handler/thin.rb +6 -1
- data/lib/rack/handler/webrick.rb +28 -28
- data/lib/rack/handler.rb +9 -26
- data/lib/rack/head.rb +17 -17
- data/lib/rack/lint.rb +55 -52
- data/lib/rack/lobster.rb +8 -6
- data/lib/rack/lock.rb +17 -10
- data/lib/rack/logger.rb +4 -2
- data/lib/rack/media_type.rb +43 -0
- data/lib/rack/{methodoverride.rb → method_override.rb} +10 -8
- data/lib/rack/mime.rb +27 -6
- data/lib/rack/mock.rb +101 -60
- data/lib/rack/multipart/generator.rb +11 -12
- data/lib/rack/multipart/parser.rb +292 -161
- data/lib/rack/multipart/uploaded_file.rb +3 -2
- data/lib/rack/multipart.rb +38 -8
- data/lib/rack/{nulllogger.rb → null_logger.rb} +3 -1
- data/lib/rack/query_parser.rb +218 -0
- data/lib/rack/recursive.rb +11 -9
- data/lib/rack/reloader.rb +10 -4
- data/lib/rack/request.rb +447 -305
- data/lib/rack/response.rb +196 -83
- data/lib/rack/rewindable_input.rb +5 -14
- data/lib/rack/runtime.rb +12 -18
- data/lib/rack/sendfile.rb +19 -14
- data/lib/rack/server.rb +118 -41
- data/lib/rack/session/abstract/id.rb +139 -94
- data/lib/rack/session/cookie.rb +34 -26
- data/lib/rack/session/memcache.rb +4 -93
- data/lib/rack/session/pool.rb +12 -10
- data/lib/rack/show_exceptions.rb +392 -0
- data/lib/rack/{showstatus.rb → show_status.rb} +7 -5
- data/lib/rack/static.rb +41 -11
- data/lib/rack/tempfile_reaper.rb +4 -2
- data/lib/rack/urlmap.rb +25 -15
- data/lib/rack/utils.rb +203 -277
- data/lib/rack.rb +76 -24
- data/rack.gemspec +25 -14
- metadata +62 -183
- data/HISTORY.md +0 -375
- data/KNOWN-ISSUES +0 -44
- data/lib/rack/backports/uri/common_18.rb +0 -56
- data/lib/rack/backports/uri/common_192.rb +0 -52
- data/lib/rack/backports/uri/common_193.rb +0 -29
- data/lib/rack/handler/evented_mongrel.rb +0 -8
- data/lib/rack/handler/mongrel.rb +0 -106
- data/lib/rack/handler/swiftiplied_mongrel.rb +0 -8
- data/lib/rack/showexceptions.rb +0 -387
- data/lib/rack/utils/okjson.rb +0 -600
- data/test/builder/anything.rb +0 -5
- data/test/builder/comment.ru +0 -4
- data/test/builder/end.ru +0 -5
- data/test/builder/line.ru +0 -1
- data/test/builder/options.ru +0 -2
- data/test/cgi/assets/folder/test.js +0 -1
- data/test/cgi/assets/fonts/font.eot +0 -1
- data/test/cgi/assets/images/image.png +0 -1
- data/test/cgi/assets/index.html +0 -1
- data/test/cgi/assets/javascripts/app.js +0 -1
- data/test/cgi/assets/stylesheets/app.css +0 -1
- data/test/cgi/lighttpd.conf +0 -26
- data/test/cgi/rackup_stub.rb +0 -6
- data/test/cgi/sample_rackup.ru +0 -5
- data/test/cgi/test +0 -9
- data/test/cgi/test+directory/test+file +0 -1
- data/test/cgi/test.fcgi +0 -8
- data/test/cgi/test.ru +0 -5
- data/test/gemloader.rb +0 -10
- data/test/multipart/bad_robots +0 -259
- data/test/multipart/binary +0 -0
- data/test/multipart/content_type_and_no_filename +0 -6
- data/test/multipart/empty +0 -10
- data/test/multipart/fail_16384_nofile +0 -814
- data/test/multipart/file1.txt +0 -1
- data/test/multipart/filename_and_modification_param +0 -7
- data/test/multipart/filename_and_no_name +0 -6
- data/test/multipart/filename_with_escaped_quotes +0 -6
- data/test/multipart/filename_with_escaped_quotes_and_modification_param +0 -7
- data/test/multipart/filename_with_null_byte +0 -7
- data/test/multipart/filename_with_percent_escaped_quotes +0 -6
- data/test/multipart/filename_with_unescaped_percentages +0 -6
- data/test/multipart/filename_with_unescaped_percentages2 +0 -6
- data/test/multipart/filename_with_unescaped_percentages3 +0 -6
- data/test/multipart/filename_with_unescaped_quotes +0 -6
- data/test/multipart/ie +0 -6
- data/test/multipart/invalid_character +0 -6
- data/test/multipart/mixed_files +0 -21
- data/test/multipart/nested +0 -10
- data/test/multipart/none +0 -9
- data/test/multipart/semicolon +0 -6
- data/test/multipart/text +0 -15
- data/test/multipart/three_files_three_fields +0 -31
- data/test/multipart/webkit +0 -32
- data/test/rackup/config.ru +0 -31
- data/test/registering_handler/rack/handler/registering_myself.rb +0 -8
- data/test/spec_auth_basic.rb +0 -81
- data/test/spec_auth_digest.rb +0 -259
- data/test/spec_body_proxy.rb +0 -85
- data/test/spec_builder.rb +0 -223
- data/test/spec_cascade.rb +0 -61
- data/test/spec_cgi.rb +0 -102
- data/test/spec_chunked.rb +0 -101
- data/test/spec_commonlogger.rb +0 -93
- data/test/spec_conditionalget.rb +0 -102
- data/test/spec_config.rb +0 -22
- data/test/spec_content_length.rb +0 -85
- data/test/spec_content_type.rb +0 -45
- data/test/spec_deflater.rb +0 -339
- data/test/spec_directory.rb +0 -88
- data/test/spec_etag.rb +0 -107
- data/test/spec_fastcgi.rb +0 -107
- data/test/spec_file.rb +0 -221
- data/test/spec_handler.rb +0 -72
- data/test/spec_head.rb +0 -45
- data/test/spec_lint.rb +0 -550
- data/test/spec_lobster.rb +0 -58
- data/test/spec_lock.rb +0 -164
- data/test/spec_logger.rb +0 -23
- data/test/spec_methodoverride.rb +0 -111
- data/test/spec_mime.rb +0 -51
- data/test/spec_mock.rb +0 -297
- data/test/spec_mongrel.rb +0 -182
- data/test/spec_multipart.rb +0 -600
- data/test/spec_nulllogger.rb +0 -20
- data/test/spec_recursive.rb +0 -72
- data/test/spec_request.rb +0 -1232
- data/test/spec_response.rb +0 -407
- data/test/spec_rewindable_input.rb +0 -118
- data/test/spec_runtime.rb +0 -49
- data/test/spec_sendfile.rb +0 -130
- data/test/spec_server.rb +0 -167
- data/test/spec_session_abstract_id.rb +0 -53
- data/test/spec_session_cookie.rb +0 -410
- data/test/spec_session_memcache.rb +0 -358
- data/test/spec_session_persisted_secure_secure_session_hash.rb +0 -73
- data/test/spec_session_pool.rb +0 -246
- data/test/spec_showexceptions.rb +0 -98
- data/test/spec_showstatus.rb +0 -103
- data/test/spec_static.rb +0 -145
- data/test/spec_tempfile_reaper.rb +0 -63
- data/test/spec_thin.rb +0 -91
- data/test/spec_urlmap.rb +0 -236
- data/test/spec_utils.rb +0 -647
- data/test/spec_version.rb +0 -17
- data/test/spec_webrick.rb +0 -184
- data/test/static/another/index.html +0 -1
- data/test/static/index.html +0 -1
- data/test/testrequest.rb +0 -78
- data/test/unregistered_handler/rack/handler/unregistered.rb +0 -7
- data/test/unregistered_handler/rack/handler/unregistered_long_one.rb +0 -7
data/test/spec_urlmap.rb
DELETED
@@ -1,236 +0,0 @@
|
|
1
|
-
require 'rack/urlmap'
|
2
|
-
require 'rack/mock'
|
3
|
-
|
4
|
-
describe Rack::URLMap do
|
5
|
-
it "dispatches paths correctly" do
|
6
|
-
app = lambda { |env|
|
7
|
-
[200, {
|
8
|
-
'X-ScriptName' => env['SCRIPT_NAME'],
|
9
|
-
'X-PathInfo' => env['PATH_INFO'],
|
10
|
-
'Content-Type' => 'text/plain'
|
11
|
-
}, [""]]
|
12
|
-
}
|
13
|
-
map = Rack::Lint.new(Rack::URLMap.new({
|
14
|
-
'http://foo.org/bar' => app,
|
15
|
-
'/foo' => app,
|
16
|
-
'/foo/bar' => app
|
17
|
-
}))
|
18
|
-
|
19
|
-
res = Rack::MockRequest.new(map).get("/")
|
20
|
-
res.should.be.not_found
|
21
|
-
|
22
|
-
res = Rack::MockRequest.new(map).get("/qux")
|
23
|
-
res.should.be.not_found
|
24
|
-
|
25
|
-
res = Rack::MockRequest.new(map).get("/foo")
|
26
|
-
res.should.be.ok
|
27
|
-
res["X-ScriptName"].should.equal "/foo"
|
28
|
-
res["X-PathInfo"].should.equal ""
|
29
|
-
|
30
|
-
res = Rack::MockRequest.new(map).get("/foo/")
|
31
|
-
res.should.be.ok
|
32
|
-
res["X-ScriptName"].should.equal "/foo"
|
33
|
-
res["X-PathInfo"].should.equal "/"
|
34
|
-
|
35
|
-
res = Rack::MockRequest.new(map).get("/foo/bar")
|
36
|
-
res.should.be.ok
|
37
|
-
res["X-ScriptName"].should.equal "/foo/bar"
|
38
|
-
res["X-PathInfo"].should.equal ""
|
39
|
-
|
40
|
-
res = Rack::MockRequest.new(map).get("/foo/bar/")
|
41
|
-
res.should.be.ok
|
42
|
-
res["X-ScriptName"].should.equal "/foo/bar"
|
43
|
-
res["X-PathInfo"].should.equal "/"
|
44
|
-
|
45
|
-
res = Rack::MockRequest.new(map).get("/foo///bar//quux")
|
46
|
-
res.status.should.equal 200
|
47
|
-
res.should.be.ok
|
48
|
-
res["X-ScriptName"].should.equal "/foo/bar"
|
49
|
-
res["X-PathInfo"].should.equal "//quux"
|
50
|
-
|
51
|
-
res = Rack::MockRequest.new(map).get("/foo/quux", "SCRIPT_NAME" => "/bleh")
|
52
|
-
res.should.be.ok
|
53
|
-
res["X-ScriptName"].should.equal "/bleh/foo"
|
54
|
-
res["X-PathInfo"].should.equal "/quux"
|
55
|
-
|
56
|
-
res = Rack::MockRequest.new(map).get("/bar", 'HTTP_HOST' => 'foo.org')
|
57
|
-
res.should.be.ok
|
58
|
-
res["X-ScriptName"].should.equal "/bar"
|
59
|
-
res["X-PathInfo"].should.be.empty
|
60
|
-
|
61
|
-
res = Rack::MockRequest.new(map).get("/bar/", 'HTTP_HOST' => 'foo.org')
|
62
|
-
res.should.be.ok
|
63
|
-
res["X-ScriptName"].should.equal "/bar"
|
64
|
-
res["X-PathInfo"].should.equal '/'
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
it "dispatches hosts correctly" do
|
69
|
-
map = Rack::Lint.new(Rack::URLMap.new("http://foo.org/" => lambda { |env|
|
70
|
-
[200,
|
71
|
-
{ "Content-Type" => "text/plain",
|
72
|
-
"X-Position" => "foo.org",
|
73
|
-
"X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
|
74
|
-
}, [""]]},
|
75
|
-
"http://subdomain.foo.org/" => lambda { |env|
|
76
|
-
[200,
|
77
|
-
{ "Content-Type" => "text/plain",
|
78
|
-
"X-Position" => "subdomain.foo.org",
|
79
|
-
"X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
|
80
|
-
}, [""]]},
|
81
|
-
"http://bar.org/" => lambda { |env|
|
82
|
-
[200,
|
83
|
-
{ "Content-Type" => "text/plain",
|
84
|
-
"X-Position" => "bar.org",
|
85
|
-
"X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
|
86
|
-
}, [""]]},
|
87
|
-
"/" => lambda { |env|
|
88
|
-
[200,
|
89
|
-
{ "Content-Type" => "text/plain",
|
90
|
-
"X-Position" => "default.org",
|
91
|
-
"X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
|
92
|
-
}, [""]]}
|
93
|
-
))
|
94
|
-
|
95
|
-
res = Rack::MockRequest.new(map).get("/")
|
96
|
-
res.should.be.ok
|
97
|
-
res["X-Position"].should.equal "default.org"
|
98
|
-
|
99
|
-
res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "bar.org")
|
100
|
-
res.should.be.ok
|
101
|
-
res["X-Position"].should.equal "bar.org"
|
102
|
-
|
103
|
-
res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "foo.org")
|
104
|
-
res.should.be.ok
|
105
|
-
res["X-Position"].should.equal "foo.org"
|
106
|
-
|
107
|
-
res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "subdomain.foo.org", "SERVER_NAME" => "foo.org")
|
108
|
-
res.should.be.ok
|
109
|
-
res["X-Position"].should.equal "subdomain.foo.org"
|
110
|
-
|
111
|
-
res = Rack::MockRequest.new(map).get("http://foo.org/")
|
112
|
-
res.should.be.ok
|
113
|
-
res["X-Position"].should.equal "foo.org"
|
114
|
-
|
115
|
-
res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "example.org")
|
116
|
-
res.should.be.ok
|
117
|
-
res["X-Position"].should.equal "default.org"
|
118
|
-
|
119
|
-
res = Rack::MockRequest.new(map).get("/",
|
120
|
-
"HTTP_HOST" => "example.org:9292",
|
121
|
-
"SERVER_PORT" => "9292")
|
122
|
-
res.should.be.ok
|
123
|
-
res["X-Position"].should.equal "default.org"
|
124
|
-
end
|
125
|
-
|
126
|
-
should "be nestable" do
|
127
|
-
map = Rack::Lint.new(Rack::URLMap.new("/foo" =>
|
128
|
-
Rack::URLMap.new("/bar" =>
|
129
|
-
Rack::URLMap.new("/quux" => lambda { |env|
|
130
|
-
[200,
|
131
|
-
{ "Content-Type" => "text/plain",
|
132
|
-
"X-Position" => "/foo/bar/quux",
|
133
|
-
"X-PathInfo" => env["PATH_INFO"],
|
134
|
-
"X-ScriptName" => env["SCRIPT_NAME"],
|
135
|
-
}, [""]]}
|
136
|
-
))))
|
137
|
-
|
138
|
-
res = Rack::MockRequest.new(map).get("/foo/bar")
|
139
|
-
res.should.be.not_found
|
140
|
-
|
141
|
-
res = Rack::MockRequest.new(map).get("/foo/bar/quux")
|
142
|
-
res.should.be.ok
|
143
|
-
res["X-Position"].should.equal "/foo/bar/quux"
|
144
|
-
res["X-PathInfo"].should.equal ""
|
145
|
-
res["X-ScriptName"].should.equal "/foo/bar/quux"
|
146
|
-
end
|
147
|
-
|
148
|
-
should "route root apps correctly" do
|
149
|
-
map = Rack::Lint.new(Rack::URLMap.new("/" => lambda { |env|
|
150
|
-
[200,
|
151
|
-
{ "Content-Type" => "text/plain",
|
152
|
-
"X-Position" => "root",
|
153
|
-
"X-PathInfo" => env["PATH_INFO"],
|
154
|
-
"X-ScriptName" => env["SCRIPT_NAME"]
|
155
|
-
}, [""]]},
|
156
|
-
"/foo" => lambda { |env|
|
157
|
-
[200,
|
158
|
-
{ "Content-Type" => "text/plain",
|
159
|
-
"X-Position" => "foo",
|
160
|
-
"X-PathInfo" => env["PATH_INFO"],
|
161
|
-
"X-ScriptName" => env["SCRIPT_NAME"]
|
162
|
-
}, [""]]}
|
163
|
-
))
|
164
|
-
|
165
|
-
res = Rack::MockRequest.new(map).get("/foo/bar")
|
166
|
-
res.should.be.ok
|
167
|
-
res["X-Position"].should.equal "foo"
|
168
|
-
res["X-PathInfo"].should.equal "/bar"
|
169
|
-
res["X-ScriptName"].should.equal "/foo"
|
170
|
-
|
171
|
-
res = Rack::MockRequest.new(map).get("/foo")
|
172
|
-
res.should.be.ok
|
173
|
-
res["X-Position"].should.equal "foo"
|
174
|
-
res["X-PathInfo"].should.equal ""
|
175
|
-
res["X-ScriptName"].should.equal "/foo"
|
176
|
-
|
177
|
-
res = Rack::MockRequest.new(map).get("/bar")
|
178
|
-
res.should.be.ok
|
179
|
-
res["X-Position"].should.equal "root"
|
180
|
-
res["X-PathInfo"].should.equal "/bar"
|
181
|
-
res["X-ScriptName"].should.equal ""
|
182
|
-
|
183
|
-
res = Rack::MockRequest.new(map).get("")
|
184
|
-
res.should.be.ok
|
185
|
-
res["X-Position"].should.equal "root"
|
186
|
-
res["X-PathInfo"].should.equal "/"
|
187
|
-
res["X-ScriptName"].should.equal ""
|
188
|
-
end
|
189
|
-
|
190
|
-
should "not squeeze slashes" do
|
191
|
-
map = Rack::Lint.new(Rack::URLMap.new("/" => lambda { |env|
|
192
|
-
[200,
|
193
|
-
{ "Content-Type" => "text/plain",
|
194
|
-
"X-Position" => "root",
|
195
|
-
"X-PathInfo" => env["PATH_INFO"],
|
196
|
-
"X-ScriptName" => env["SCRIPT_NAME"]
|
197
|
-
}, [""]]},
|
198
|
-
"/foo" => lambda { |env|
|
199
|
-
[200,
|
200
|
-
{ "Content-Type" => "text/plain",
|
201
|
-
"X-Position" => "foo",
|
202
|
-
"X-PathInfo" => env["PATH_INFO"],
|
203
|
-
"X-ScriptName" => env["SCRIPT_NAME"]
|
204
|
-
}, [""]]}
|
205
|
-
))
|
206
|
-
|
207
|
-
res = Rack::MockRequest.new(map).get("/http://example.org/bar")
|
208
|
-
res.should.be.ok
|
209
|
-
res["X-Position"].should.equal "root"
|
210
|
-
res["X-PathInfo"].should.equal "/http://example.org/bar"
|
211
|
-
res["X-ScriptName"].should.equal ""
|
212
|
-
end
|
213
|
-
|
214
|
-
should "not be case sensitive with hosts" do
|
215
|
-
map = Rack::Lint.new(Rack::URLMap.new("http://example.org/" => lambda { |env|
|
216
|
-
[200,
|
217
|
-
{ "Content-Type" => "text/plain",
|
218
|
-
"X-Position" => "root",
|
219
|
-
"X-PathInfo" => env["PATH_INFO"],
|
220
|
-
"X-ScriptName" => env["SCRIPT_NAME"]
|
221
|
-
}, [""]]}
|
222
|
-
))
|
223
|
-
|
224
|
-
res = Rack::MockRequest.new(map).get("http://example.org/")
|
225
|
-
res.should.be.ok
|
226
|
-
res["X-Position"].should.equal "root"
|
227
|
-
res["X-PathInfo"].should.equal "/"
|
228
|
-
res["X-ScriptName"].should.equal ""
|
229
|
-
|
230
|
-
res = Rack::MockRequest.new(map).get("http://EXAMPLE.ORG/")
|
231
|
-
res.should.be.ok
|
232
|
-
res["X-Position"].should.equal "root"
|
233
|
-
res["X-PathInfo"].should.equal "/"
|
234
|
-
res["X-ScriptName"].should.equal ""
|
235
|
-
end
|
236
|
-
end
|