Created
May 3, 2010 19:26
-
-
Save lsiden/388492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/rack/chunked.rb b/lib/rack/chunked.rb | |
index dddf969..0ee8fb9 100644 | |
--- a/lib/rack/chunked.rb | |
+++ b/lib/rack/chunked.rb | |
@@ -35,7 +35,7 @@ module Rack | |
def each | |
term = "\r\n" | |
@body.each do |chunk| | |
- size = bytesize(chunk) | |
+ size = chunk.nil? ? 0 : bytesize(chunk) | |
next if size == 0 | |
yield [size.to_s(16), term, chunk, term].join | |
end | |
diff --git a/lib/rack/content_length.rb b/lib/rack/content_length.rb | |
index 1e56d43..ba72ef2 100644 | |
--- a/lib/rack/content_length.rb | |
+++ b/lib/rack/content_length.rb | |
@@ -13,7 +13,7 @@ module Rack | |
status, headers, body = @app.call(env) | |
headers = HeaderHash.new(headers) | |
- if !STATUS_WITH_NO_ENTITY_BODY.include?(status) && | |
+ if !STATUS_WITH_NO_ENTITY_BODY.include?(status.to_i) && | |
!headers['Content-Length'] && | |
!headers['Transfer-Encoding'] && | |
(body.respond_to?(:to_ary) || body.respond_to?(:to_str)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Patch to Commit f 10713c