Skip to content

Commit

Permalink
Hi
Browse files Browse the repository at this point in the history
I'm having problems posting data containing multibyte chars using net/http. I found an old bug in the ruby 1.9 bug tracker that was resolved by switching body.length to body.bytesize. The same thing needs to be done in the http_connection gem.

http_connection-1.3.0/lib/net_fix.rb line 94 contains:

  self.content_length = body.length
it should be changed to:

  self.content_length = body.bytesize
to work with multi byte chars.

/ Jonas
  • Loading branch information
Travis Reeder committed Sep 13, 2010
1 parent 30d8aa7 commit a683f29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/net_fix.rb
Expand Up @@ -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.bytesize
delete 'Transfer-Encoding'
supply_default_content_type
write_header(sock, ver, path) unless send_only == :body
Expand Down

0 comments on commit a683f29

Please sign in to comment.