lib/rack/multipart/parser.rb in rack-2.0.6 vs lib/rack/multipart/parser.rb in rack-2.0.7
- old
+ new
@@ -37,12 +37,10 @@
end
str
end
- def eof?; @content_length == @cursor; end
-
def rewind
@io.rewind
end
end
@@ -63,15 +61,15 @@
return EMPTY unless boundary
io = BoundedIO.new(io, content_length) if content_length
parser = new(boundary, tmpfile, bufsize, qp)
- parser.on_read io.read(bufsize), io.eof?
+ parser.on_read io.read(bufsize)
loop do
break if parser.state == :DONE
- parser.on_read io.read(bufsize), io.eof?
+ parser.on_read io.read(bufsize)
end
io.rewind
parser.result
end
@@ -179,12 +177,12 @@
@state = :FAST_FORWARD
@mime_index = 0
@collector = Collector.new tempfile
end
- def on_read content, eof
- handle_empty_content!(content, eof)
+ def on_read content
+ handle_empty_content!(content)
@buf << content
run_parser
end
def result
@@ -356,13 +354,12 @@
name.force_encoding(encoding)
body.force_encoding(encoding)
end
- def handle_empty_content!(content, eof)
+ def handle_empty_content!(content)
if content.nil? || content.empty?
- raise EOFError if eof
- return true
+ raise EOFError
end
end
end
end
end