rack 1.4.6 → 1.4.7
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/lib/rack.rb +1 -1
- data/lib/rack/multipart/parser.rb +5 -4
- data/rack.gemspec +1 -1
- data/test/cgi/lighttpd.errors +1 -0
- data/test/multipart/three_files_three_fields +31 -0
- data/test/spec_multipart.rb +27 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3c31ab2a14865deb3a2572ffb4e5041805e03b6
|
4
|
+
data.tar.gz: 4c46599689ac47586891e494975865d24047c364
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46969b1d5dd0866d2fe3bc407cd15d862ea6cdafb05260fa7c7f4fea7832c927e690de1a46e685ef0e52f0dafbbee19780fc164b27e672b2d598ff4ffd758565
|
7
|
+
data.tar.gz: 3ad91dddc637cd4e7285d4e4dee55aab4fad2c3327cb0dfa8b6e10fbb3d00643bb0a83985f3e28f6eafb9c9439cb9295d4d8d9e62f1a6f54013e626a55e05e44
|
data/lib/rack.rb
CHANGED
@@ -18,14 +18,15 @@ module Rack
|
|
18
18
|
|
19
19
|
opened_files = 0
|
20
20
|
loop do
|
21
|
-
if Utils.multipart_part_limit > 0
|
22
|
-
raise MultipartLimitError, 'Maximum file multiparts in content reached' if opened_files >= Utils.multipart_part_limit
|
23
|
-
opened_files += 1
|
24
|
-
end
|
25
21
|
|
26
22
|
head, filename, content_type, name, body =
|
27
23
|
get_current_head_and_filename_and_content_type_and_name_and_body
|
28
24
|
|
25
|
+
if Utils.multipart_part_limit > 0
|
26
|
+
opened_files += 1 if filename
|
27
|
+
raise MultipartLimitError, 'Maximum file multiparts in content reached' if opened_files >= Utils.multipart_part_limit
|
28
|
+
end
|
29
|
+
|
29
30
|
# Save the rest.
|
30
31
|
if i = @buf.index(rx)
|
31
32
|
body << @buf.slice!(0, i)
|
data/rack.gemspec
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
2015-06-16 14:11:43: (log.c.164) server started
|
@@ -0,0 +1,31 @@
|
|
1
|
+
--AaB03x
|
2
|
+
content-disposition: form-data; name="reply"
|
3
|
+
|
4
|
+
yes
|
5
|
+
--AaB03x
|
6
|
+
content-disposition: form-data; name="to"
|
7
|
+
|
8
|
+
people
|
9
|
+
--AaB03x
|
10
|
+
content-disposition: form-data; name="from"
|
11
|
+
|
12
|
+
others
|
13
|
+
--AaB03x
|
14
|
+
content-disposition: form-data; name="fileupload1"; filename="file1.jpg"
|
15
|
+
Content-Type: image/jpeg
|
16
|
+
Content-Transfer-Encoding: base64
|
17
|
+
|
18
|
+
/9j/4AAQSkZJRgABAQAAAQABAAD//gA+Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcg
|
19
|
+
--AaB03x
|
20
|
+
content-disposition: form-data; name="fileupload2"; filename="file2.jpg"
|
21
|
+
Content-Type: image/jpeg
|
22
|
+
Content-Transfer-Encoding: base64
|
23
|
+
|
24
|
+
/9j/4AAQSkZJRgABAQAAAQABAAD//gA+Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcg
|
25
|
+
--AaB03x
|
26
|
+
content-disposition: form-data; name="fileupload3"; filename="file3.jpg"
|
27
|
+
Content-Type: image/jpeg
|
28
|
+
Content-Transfer-Encoding: base64
|
29
|
+
|
30
|
+
/9j/4AAQSkZJRgABAQAAAQABAAD//gA+Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcg
|
31
|
+
--AaB03x--
|
data/test/spec_multipart.rb
CHANGED
@@ -389,6 +389,33 @@ Content-Type: image/jpeg\r
|
|
389
389
|
end
|
390
390
|
end
|
391
391
|
|
392
|
+
should "not reach a multi-part limit" do
|
393
|
+
begin
|
394
|
+
previous_limit = Rack::Utils.multipart_part_limit
|
395
|
+
Rack::Utils.multipart_part_limit = 4
|
396
|
+
|
397
|
+
env = Rack::MockRequest.env_for '/', multipart_fixture(:three_files_three_fields)
|
398
|
+
params = Rack::Multipart.parse_multipart(env)
|
399
|
+
params['reply'].should.equal 'yes'
|
400
|
+
params['to'].should.equal 'people'
|
401
|
+
params['from'].should.equal 'others'
|
402
|
+
ensure
|
403
|
+
Rack::Utils.multipart_part_limit = previous_limit
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
should "reach a multipart limit" do
|
408
|
+
begin
|
409
|
+
previous_limit = Rack::Utils.multipart_part_limit
|
410
|
+
Rack::Utils.multipart_part_limit = 3
|
411
|
+
|
412
|
+
env = Rack::MockRequest.env_for '/', multipart_fixture(:three_files_three_fields)
|
413
|
+
lambda { Rack::Multipart.parse_multipart(env) }.should.raise(Rack::Multipart::MultipartLimitError)
|
414
|
+
ensure
|
415
|
+
Rack::Utils.multipart_part_limit = previous_limit
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
392
419
|
should "return nil if no UploadedFiles were used" do
|
393
420
|
data = Rack::Multipart.build_multipart("people" => [{"submit-name" => "Larry", "files" => "contents"}])
|
394
421
|
data.should.equal nil
|
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: 1.4.
|
4
|
+
version: 1.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Neukirchen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bacon
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- test/cgi/assets/javascripts/app.js
|
201
201
|
- test/cgi/assets/stylesheets/app.css
|
202
202
|
- test/cgi/lighttpd.conf
|
203
|
+
- test/cgi/lighttpd.errors
|
203
204
|
- test/cgi/rackup_stub.rb
|
204
205
|
- test/cgi/sample_rackup.ru
|
205
206
|
- test/cgi/test
|
@@ -227,6 +228,7 @@ files:
|
|
227
228
|
- test/multipart/none
|
228
229
|
- test/multipart/semicolon
|
229
230
|
- test/multipart/text
|
231
|
+
- test/multipart/three_files_three_fields
|
230
232
|
- test/multipart/webkit
|
231
233
|
- test/rackup/config.ru
|
232
234
|
- test/registering_handler/rack/handler/registering_myself.rb
|