Skip to content
Browse files

Make set_content_length work for every valid rack spec. Couldn't find…

… appropriate test - maybe i'm blind.
  • Loading branch information...
1 parent fcf2a01 commit a45ee2854a8eee4125bace627b4945571d96cae0 @raggi committed Jun 10, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/thin/connection.rb
View
8 lib/thin/connection.rb
@@ -224,6 +224,14 @@ def set_content_length(result)
bytes += p.respond_to?(:bytesize) ? p.bytesize : p.size
end
headers[CONTENT_LENGTH] = bytes.to_s
+ else
+ bytes, nbody = 0, []
+ body.each do |p|
+ bytes += p.respond_to?(:bytesize) ? p.bytesize : p.size
+ nbody << p
+ end
+ headers[CONTENT_LENGTH] = bytes.to_s
+ result[2] = nbody
end
end
end

0 comments on commit a45ee28

Please sign in to comment.
Something went wrong with that request. Please try again.