rack 2.0.3 → 2.0.4
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 +5 -5
- data/README.rdoc +1 -1
- data/SPEC +8 -7
- data/lib/rack.rb +1 -1
- data/lib/rack/chunked.rb +1 -1
- data/lib/rack/etag.rb +1 -1
- data/lib/rack/lock.rb +12 -3
- data/lib/rack/mock.rb +1 -1
- data/lib/rack/multipart/parser.rb +11 -9
- data/rack.gemspec +2 -3
- data/test/spec_lock.rb +11 -1
- data/test/spec_webrick.rb +5 -8
- metadata +45 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ef26a00e7db43ca467739ef2a8c4e7c598c424d8152e50ad4927a7698d560da6
|
4
|
+
data.tar.gz: '04810cccaca82d6e19425498db464d90a778b5d8ae496693d5f8dd4686c92c3a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 429a51a2a7fcbaf5e80ab067e9df1bd59891754d9239b2cbe33379cddbf2ab774f49c715db6113d13ab7a6530d564fa47fd8a3a63b4fcc9151e5dce0f8e83f1a
|
7
|
+
data.tar.gz: d97fe3a8782e0025e55a6ae555185be9e4bf9af9e0eb2976a3f0286567b2f757d323eb069bc1886789f872cad6120aab41c64d9977d5a904de60e3e90ad6c41c
|
data/README.rdoc
CHANGED
@@ -295,7 +295,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
295
295
|
|
296
296
|
== Links
|
297
297
|
|
298
|
-
Rack:: <
|
298
|
+
Rack:: <https://rack.github.io/>
|
299
299
|
Official Rack repositories:: <https://github.com/rack>
|
300
300
|
Rack Bug Tracking:: <https://github.com/rack/rack/issues>
|
301
301
|
rack-devel mailing list:: <https://groups.google.com/group/rack-devel>
|
data/SPEC
CHANGED
@@ -60,8 +60,8 @@ below.
|
|
60
60
|
the presence or absence of the
|
61
61
|
appropriate HTTP header in the
|
62
62
|
request. See
|
63
|
-
|
64
|
-
RFC3875 section 4.1.18
|
63
|
+
<a href="https://tools.ietf.org/html/rfc3875#section-4.1.18">
|
64
|
+
RFC3875 section 4.1.18</a> for
|
65
65
|
specific behavior.
|
66
66
|
In addition to this, the Rack environment must include these
|
67
67
|
Rack-specific variables:
|
@@ -98,12 +98,13 @@ Rack-specific variables:
|
|
98
98
|
Additional environment specifications have approved to
|
99
99
|
standardized middleware APIs. None of these are required to
|
100
100
|
be implemented by the server.
|
101
|
-
<tt>rack.session</tt>:: A hash like interface for storing
|
101
|
+
<tt>rack.session</tt>:: A hash like interface for storing
|
102
|
+
request session data.
|
102
103
|
The store must implement:
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
store(key, value) (aliased as []=);
|
105
|
+
fetch(key, default = nil) (aliased as []);
|
106
|
+
delete(key);
|
107
|
+
clear;
|
107
108
|
<tt>rack.logger</tt>:: A common object interface for logging messages.
|
108
109
|
The object must implement:
|
109
110
|
info(message, &block)
|
data/lib/rack.rb
CHANGED
data/lib/rack/chunked.rb
CHANGED
data/lib/rack/etag.rb
CHANGED
data/lib/rack/lock.rb
CHANGED
@@ -11,12 +11,21 @@ module Rack
|
|
11
11
|
|
12
12
|
def call(env)
|
13
13
|
@mutex.lock
|
14
|
+
@env = env
|
15
|
+
@old_rack_multithread = env[RACK_MULTITHREAD]
|
14
16
|
begin
|
15
|
-
response = @app.call(env.merge(RACK_MULTITHREAD => false))
|
16
|
-
returned = response << BodyProxy.new(response.pop) {
|
17
|
+
response = @app.call(env.merge!(RACK_MULTITHREAD => false))
|
18
|
+
returned = response << BodyProxy.new(response.pop) { unlock }
|
17
19
|
ensure
|
18
|
-
|
20
|
+
unlock unless returned
|
19
21
|
end
|
20
22
|
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def unlock
|
27
|
+
@mutex.unlock
|
28
|
+
@env[RACK_MULTITHREAD] = @old_rack_multithread
|
29
|
+
end
|
21
30
|
end
|
22
31
|
end
|
data/lib/rack/mock.rb
CHANGED
@@ -5,7 +5,7 @@ module Rack
|
|
5
5
|
class MultipartPartLimitError < Errno::EMFILE; end
|
6
6
|
|
7
7
|
class Parser
|
8
|
-
BUFSIZE =
|
8
|
+
BUFSIZE = 1_048_576
|
9
9
|
TEXT_PLAIN = "text/plain"
|
10
10
|
TEMPFILE_FACTORY = lambda { |filename, content_type|
|
11
11
|
Tempfile.new(["RackMultipart", ::File.extname(filename.gsub("\0".freeze, '%00'.freeze))])
|
@@ -135,7 +135,7 @@ module Rack
|
|
135
135
|
klass = TempfilePart
|
136
136
|
@open_files += 1
|
137
137
|
else
|
138
|
-
body =
|
138
|
+
body = String.new
|
139
139
|
klass = BufferPart
|
140
140
|
end
|
141
141
|
|
@@ -165,15 +165,15 @@ module Rack
|
|
165
165
|
attr_reader :state
|
166
166
|
|
167
167
|
def initialize(boundary, tempfile, bufsize, query_parser)
|
168
|
-
@buf =
|
168
|
+
@buf = String.new
|
169
169
|
|
170
170
|
@query_parser = query_parser
|
171
171
|
@params = query_parser.make_params
|
172
172
|
@boundary = "--#{boundary}"
|
173
|
-
@boundary_size = @boundary.bytesize + EOL.size
|
174
173
|
@bufsize = bufsize
|
175
174
|
|
176
175
|
@rx = /(?:#{EOL})?#{Regexp.quote(@boundary)}(#{EOL}|--)/n
|
176
|
+
@rx_max_size = EOL.size + @boundary.bytesize + [EOL.size, '--'.size].max
|
177
177
|
@full_boundary = @boundary
|
178
178
|
@end_boundary = @boundary + '--'
|
179
179
|
@state = :FAST_FORWARD
|
@@ -263,15 +263,17 @@ module Rack
|
|
263
263
|
end
|
264
264
|
|
265
265
|
def handle_mime_body
|
266
|
-
if @buf
|
266
|
+
if i = @buf.index(rx)
|
267
267
|
# Save the rest.
|
268
|
-
|
269
|
-
|
270
|
-
@buf.slice!(0, 2) # Remove \r\n after the content
|
271
|
-
end
|
268
|
+
@collector.on_mime_body @mime_index, @buf.slice!(0, i)
|
269
|
+
@buf.slice!(0, 2) # Remove \r\n after the content
|
272
270
|
@state = :CONSUME_TOKEN
|
273
271
|
@mime_index += 1
|
274
272
|
else
|
273
|
+
# Save the read body part.
|
274
|
+
if @rx_max_size < @buf.size
|
275
|
+
@collector.on_mime_body @mime_index, @buf.slice!(0, @buf.size - @rx_max_size)
|
276
|
+
end
|
275
277
|
:want_read
|
276
278
|
end
|
277
279
|
end
|
data/rack.gemspec
CHANGED
@@ -12,7 +12,7 @@ the simplest way possible, it unifies and distills the API for web
|
|
12
12
|
servers, web frameworks, and software in between (the so-called
|
13
13
|
middleware) into a single method call.
|
14
14
|
|
15
|
-
Also see
|
15
|
+
Also see https://rack.github.io/.
|
16
16
|
EOF
|
17
17
|
|
18
18
|
s.files = Dir['{bin/*,contrib/*,example/*,lib/**/*,test/**/*}'] +
|
@@ -25,11 +25,10 @@ EOF
|
|
25
25
|
|
26
26
|
s.author = 'Christian Neukirchen'
|
27
27
|
s.email = 'chneukirchen@gmail.com'
|
28
|
-
s.homepage = '
|
28
|
+
s.homepage = 'https://rack.github.io/'
|
29
29
|
s.required_ruby_version = '>= 2.2.2'
|
30
30
|
|
31
31
|
s.add_development_dependency 'minitest', "~> 5.0"
|
32
32
|
s.add_development_dependency 'minitest-sprint'
|
33
|
-
s.add_development_dependency 'concurrent-ruby'
|
34
33
|
s.add_development_dependency 'rake'
|
35
34
|
end
|
data/test/spec_lock.rb
CHANGED
@@ -147,7 +147,8 @@ describe Rack::Lock do
|
|
147
147
|
}, false)
|
148
148
|
env = Rack::MockRequest.env_for("/")
|
149
149
|
env['rack.multithread'].must_equal true
|
150
|
-
app.call(env)
|
150
|
+
_, _, body = app.call(env)
|
151
|
+
body.close
|
151
152
|
env['rack.multithread'].must_equal true
|
152
153
|
end
|
153
154
|
|
@@ -191,4 +192,13 @@ describe Rack::Lock do
|
|
191
192
|
lambda { app.call(env) }.must_raise Exception
|
192
193
|
lock.synchronized.must_equal false
|
193
194
|
end
|
195
|
+
|
196
|
+
it "not replace the environment" do
|
197
|
+
env = Rack::MockRequest.env_for("/")
|
198
|
+
app = lock_app(lambda { |inner_env| [200, {"Content-Type" => "text/plain"}, [inner_env.object_id.to_s]] })
|
199
|
+
|
200
|
+
_, _, body = app.call(env)
|
201
|
+
|
202
|
+
body.to_enum.to_a.must_equal [env.object_id.to_s]
|
203
|
+
end
|
194
204
|
end
|
data/test/spec_webrick.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'rack/mock'
|
3
|
-
require '
|
4
|
-
require 'concurrent/atomic/count_down_latch'
|
3
|
+
require 'thread'
|
5
4
|
require File.expand_path('../testrequest', __FILE__)
|
6
5
|
|
7
6
|
Thread.abort_on_exception = true
|
@@ -120,8 +119,7 @@ describe Rack::Handler::WEBrick do
|
|
120
119
|
end
|
121
120
|
|
122
121
|
it "provide a .run" do
|
123
|
-
|
124
|
-
latch = Concurrent::CountDownLatch.new 1
|
122
|
+
queue = Queue.new
|
125
123
|
|
126
124
|
t = Thread.new do
|
127
125
|
Rack::Handler::WEBrick.run(lambda {},
|
@@ -132,13 +130,12 @@ describe Rack::Handler::WEBrick do
|
|
132
130
|
:AccessLog => []}) { |server|
|
133
131
|
block_ran = true
|
134
132
|
assert_kind_of WEBrick::HTTPServer, server
|
135
|
-
|
136
|
-
latch.count_down
|
133
|
+
queue.push(server)
|
137
134
|
}
|
138
135
|
end
|
139
136
|
|
140
|
-
|
141
|
-
|
137
|
+
server = queue.pop
|
138
|
+
server.shutdown
|
142
139
|
t.join
|
143
140
|
end
|
144
141
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Neukirchen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: concurrent-ruby
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +59,7 @@ description: |
|
|
73
59
|
servers, web frameworks, and software in between (the so-called
|
74
60
|
middleware) into a single method call.
|
75
61
|
|
76
|
-
Also see
|
62
|
+
Also see https://rack.github.io/.
|
77
63
|
email: chneukirchen@gmail.com
|
78
64
|
executables:
|
79
65
|
- rackup
|
@@ -269,7 +255,7 @@ files:
|
|
269
255
|
- test/testrequest.rb
|
270
256
|
- test/unregistered_handler/rack/handler/unregistered.rb
|
271
257
|
- test/unregistered_handler/rack/handler/unregistered_long_one.rb
|
272
|
-
homepage:
|
258
|
+
homepage: https://rack.github.io/
|
273
259
|
licenses:
|
274
260
|
- MIT
|
275
261
|
metadata: {}
|
@@ -289,59 +275,59 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
289
275
|
version: '0'
|
290
276
|
requirements: []
|
291
277
|
rubyforge_project:
|
292
|
-
rubygems_version: 2.
|
278
|
+
rubygems_version: 2.7.3
|
293
279
|
signing_key:
|
294
280
|
specification_version: 4
|
295
281
|
summary: a modular Ruby webserver interface
|
296
282
|
test_files:
|
297
|
-
- test/
|
298
|
-
- test/spec_auth_digest.rb
|
299
|
-
- test/spec_body_proxy.rb
|
300
|
-
- test/spec_builder.rb
|
301
|
-
- test/spec_cascade.rb
|
302
|
-
- test/spec_cgi.rb
|
303
|
-
- test/spec_chunked.rb
|
304
|
-
- test/spec_common_logger.rb
|
305
|
-
- test/spec_conditional_get.rb
|
306
|
-
- test/spec_config.rb
|
307
|
-
- test/spec_content_length.rb
|
308
|
-
- test/spec_content_type.rb
|
283
|
+
- test/spec_multipart.rb
|
309
284
|
- test/spec_deflater.rb
|
310
|
-
- test/
|
285
|
+
- test/spec_static.rb
|
286
|
+
- test/spec_session_cookie.rb
|
287
|
+
- test/spec_session_pool.rb
|
311
288
|
- test/spec_etag.rb
|
312
|
-
- test/
|
313
|
-
- test/spec_fastcgi.rb
|
314
|
-
- test/spec_file.rb
|
289
|
+
- test/spec_version.rb
|
315
290
|
- test/spec_handler.rb
|
316
|
-
- test/
|
317
|
-
- test/
|
318
|
-
- test/spec_lobster.rb
|
319
|
-
- test/spec_lock.rb
|
320
|
-
- test/spec_logger.rb
|
321
|
-
- test/spec_media_type.rb
|
322
|
-
- test/spec_method_override.rb
|
291
|
+
- test/spec_thin.rb
|
292
|
+
- test/spec_session_abstract_id.rb
|
323
293
|
- test/spec_mime.rb
|
324
|
-
- test/spec_mock.rb
|
325
|
-
- test/spec_multipart.rb
|
326
|
-
- test/spec_null_logger.rb
|
327
294
|
- test/spec_recursive.rb
|
295
|
+
- test/spec_null_logger.rb
|
296
|
+
- test/spec_media_type.rb
|
297
|
+
- test/spec_cgi.rb
|
298
|
+
- test/spec_method_override.rb
|
299
|
+
- test/spec_content_type.rb
|
300
|
+
- test/spec_session_abstract_session_hash.rb
|
328
301
|
- test/spec_request.rb
|
329
|
-
- test/
|
330
|
-
- test/
|
302
|
+
- test/spec_chunked.rb
|
303
|
+
- test/spec_show_exceptions.rb
|
331
304
|
- test/spec_runtime.rb
|
305
|
+
- test/spec_fastcgi.rb
|
306
|
+
- test/spec_common_logger.rb
|
307
|
+
- test/spec_builder.rb
|
308
|
+
- test/spec_config.rb
|
309
|
+
- test/spec_utils.rb
|
332
310
|
- test/spec_sendfile.rb
|
311
|
+
- test/spec_lobster.rb
|
312
|
+
- test/spec_lint.rb
|
313
|
+
- test/spec_conditional_get.rb
|
314
|
+
- test/spec_tempfile_reaper.rb
|
315
|
+
- test/spec_mock.rb
|
333
316
|
- test/spec_server.rb
|
334
|
-
- test/
|
335
|
-
- test/
|
336
|
-
- test/
|
337
|
-
- test/
|
338
|
-
- test/spec_session_pool.rb
|
339
|
-
- test/spec_show_exceptions.rb
|
317
|
+
- test/spec_directory.rb
|
318
|
+
- test/spec_webrick.rb
|
319
|
+
- test/spec_response.rb
|
320
|
+
- test/spec_file.rb
|
340
321
|
- test/spec_show_status.rb
|
341
|
-
- test/
|
342
|
-
- test/
|
343
|
-
- test/
|
322
|
+
- test/spec_body_proxy.rb
|
323
|
+
- test/spec_logger.rb
|
324
|
+
- test/spec_auth_digest.rb
|
344
325
|
- test/spec_urlmap.rb
|
345
|
-
- test/
|
346
|
-
- test/
|
347
|
-
- test/
|
326
|
+
- test/spec_events.rb
|
327
|
+
- test/spec_cascade.rb
|
328
|
+
- test/spec_auth_basic.rb
|
329
|
+
- test/spec_head.rb
|
330
|
+
- test/spec_lock.rb
|
331
|
+
- test/spec_rewindable_input.rb
|
332
|
+
- test/spec_session_memcache.rb
|
333
|
+
- test/spec_content_length.rb
|