summary refs log tree commit
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-27 16:19:03 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-27 16:19:03 -0700
commitdd8afc900c9c989a466b417dfb48499963efd5f0 (patch)
tree6bee300a024f0200d3ce9ae2523f98dd625d8167
parent896471f3bc5a13d3ed5380b5998dadc51326af0d (diff)
downloadrack-dd8afc900c9c989a466b417dfb48499963efd5f0.tar.gz
don't set `@content_length` to a magic value
Let just use a local boolean to determine whether or not the parser
should leave the loop
-rw-r--r--lib/rack/multipart/parser.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rack/multipart/parser.rb b/lib/rack/multipart/parser.rb
index 6478b93f..b04d39bb 100644
--- a/lib/rack/multipart/parser.rb
+++ b/lib/rack/multipart/parser.rb
@@ -65,12 +65,13 @@ module Rack
             end
           end
 
+          should_break = false
           # Save the rest.
           if i = @buf.index(rx)
             body << @buf.slice!(0, i)
             @buf.slice!(0, @boundary_size+2)
 
-            @content_length = -1  if $1 == "--"
+            should_break = true if $1 == "--"
           end
 
           get_data(filename, body, content_type, name, head) do |data|
@@ -80,7 +81,7 @@ module Rack
           end
 
           # break if we're at the end of a buffer, but not if it is the end of a field
-          break if (@buf.empty? && $1 != EOL) || @content_length == -1
+          break if (@buf.empty? && $1 != EOL) || should_break
         end
 
         @env[RACK_TEMPFILES] = opened_files