Skip to content

Instantly share code, notes, and snippets.

@lsiden
Created May 3, 2010 19:26
Show Gist options
  • Save lsiden/388492 to your computer and use it in GitHub Desktop.
Save lsiden/388492 to your computer and use it in GitHub Desktop.
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))
@lsiden
Copy link
Author

lsiden commented May 3, 2010

Patch to Commit f 10713c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment