Permalink
Browse files

Merge pull request #4 from expandrive/master

Ruby 1.9 support
  • Loading branch information...
2 parents 3ae7c27 + cf41881 commit 133c57e0a70657960ecd81c4c906c6000f5c1ee3 @danabr committed Aug 21, 2012
Showing with 3 additions and 4 deletions.
  1. +2 −2 lib/multipart_parser/parser.rb
  2. +1 −2 test/multipart_parser/parser_test.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]
@@ -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

0 comments on commit 133c57e

Please sign in to comment.