Browse files

Merge pull request #10 from kristianm/content-length-fix

Set correct content-length for possible multibyte strings
  • Loading branch information...
2 parents 56b0e5e + adf3aae commit ab45a203c6e7aea45e0cd7d40fdc200b147feb41 @konstantin-dzreev konstantin-dzreev committed Apr 2, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/net_fix.rb
View
2 lib/net_fix.rb
@@ -91,7 +91,7 @@ def exec(sock, ver, path, send_only=nil) #:nodoc: internal use only
private
def send_request_with_body(sock, ver, path, body, send_only=nil)
- self.content_length = body.length
+ self.content_length = body.respond_to?(:bytesize) ? body.bytesize : body.length
delete 'Transfer-Encoding'
supply_default_content_type
write_header(sock, ver, path) unless send_only == :body

0 comments on commit ab45a20

Please sign in to comment.