Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use the byte size, not the character size. Fixes #45

  • Loading branch information...
commit dcc93b0e0e607b5c56009b41f25fdb932bc2635e 1 parent fdf03f4
@evanphx authored
Showing with 9 additions and 1 deletion.
  1. +7 −0 lib/puma/compat.rb
  2. +2 −1  lib/puma/server.rb
View
7 lib/puma/compat.rb
@@ -0,0 +1,7 @@
+# Provides code to work properly on 1.8 and 1.9
+
+class String
+ unless method_defined? :bytesize
+ alias_method :bytesize, :size
+ end
+end
View
3  lib/puma/server.rb
@@ -5,6 +5,7 @@
require 'puma/const'
require 'puma/events'
require 'puma/null_io'
+require 'puma/compat'
require 'puma/puma_http11'
@@ -463,7 +464,7 @@ def handle_request(env, client, body, cl)
res_body.each do |part|
if chunked
- client.write part.size.to_s(16)
+ client.write part.bytesize.to_s(16)
client.write line_ending
client.write part
client.write line_ending
Please sign in to comment.
Something went wrong with that request. Please try again.