Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ruby 1.9 compatibility

  • Loading branch information...
commit cf41881a9b153377de3268983b66155df9d5290d 1 parent 3ae7c27
@hemancuso hemancuso authored
View
4 lib/multipart_parser/parser.rb
@@ -22,7 +22,7 @@ def init_with_boundary(boundary)
@boundary_chars = {}
@boundary.each_byte do |b|
- @boundary_chars[b] = true
+ @boundary_chars[b.chr] = true
end
end
@@ -137,7 +137,7 @@ def write(buffer)
# See http://debuggable.com/posts/parsing-file-uploads-at-500-
# mb-s-with-node-js:4c03862e-351c-4faa-bb67-4365cbdd56cb
while i + boundary_length <= buffer_length
- break if boundary_chars.has_key? buffer[i + boundary_end]
+ break if boundary_chars.has_key? buffer[i + boundary_end].chr
i += boundary_length
end
c = buffer[i, 1]
View
3  test/multipart_parser/parser_test.rb
@@ -11,8 +11,7 @@ def parser.boundary_chars; @boundary_chars end
parser.init_with_boundary("abc")
assert_equal "\r\n--abc", parser.boundary
- expected_bc = {13 => true, 10 => true, 45 => true, 97 => true,
- 98 => true, 99 => true}
+ expected_bc = {"\r"=>true, "\n"=>true, "-"=>true, "a"=>true, "b"=>true, "c"=>true}
assert_equal expected_bc, parser.boundary_chars
end
Please sign in to comment.
Something went wrong with that request. Please try again.