rack 1.5.4 → 1.5.5
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: ddc7522db220a6e7fef72e5720df45c3e78a9b54
|
4
|
+
data.tar.gz: c0b77fe5d69c8bcfbd315494f00541e4e72d4f35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c9e7ad0586b57f002aab11b31758620c0c314ff77998500d67a6bf1b7eb6c6edcd74630a0642ea71a78da8866a281c9f74a3f540fd6a9296e1bb4cf7ea3dcbe
|
7
|
+
data.tar.gz: 51fb9d24391b01c03a9dcc0c1b7cf453d7d3320be8bc97ce9bf4a65656cbe820ae1edef3d587b3595ed64c6dabe3e31d86effb92b79a3461a78dbdeb874375d7
|
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.5.
|
4
|
+
version: 1.5.5
|
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
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- test/cgi/assets/javascripts/app.js
|
146
146
|
- test/cgi/assets/stylesheets/app.css
|
147
147
|
- test/cgi/lighttpd.conf
|
148
|
+
- test/cgi/lighttpd.errors
|
148
149
|
- test/cgi/rackup_stub.rb
|
149
150
|
- test/cgi/sample_rackup.ru
|
150
151
|
- test/cgi/test
|
@@ -172,6 +173,7 @@ files:
|
|
172
173
|
- test/multipart/none
|
173
174
|
- test/multipart/semicolon
|
174
175
|
- test/multipart/text
|
176
|
+
- test/multipart/three_files_three_fields
|
175
177
|
- test/multipart/webkit
|
176
178
|
- test/rackup/config.ru
|
177
179
|
- test/registering_handler/rack/handler/registering_myself.rb
|