Bug #203

net/http sends wrong content-length

Added by Anonymous almost 4 years ago. Updated about 1 year ago.

Status:Closed Start date:06/27/2008
Priority:Normal Due date:
Assignee:aamine (Minero Aoki) % Done:

100%

Category:-
Target version:-
ruby -v:

Description

String#size returns count of chars, not count of bytes.

It is necessary to use bytesize method.


 Index: lib/net/http.rb
 ===================================================================
 --- lib/net/http.rb     (revision 17614)
 +++ lib/net/http.rb     (working copy)
 @@ -1643,7 +1643,7 @@
      private

      def send_request_with_body(sock, ver, path, body)
 -      self.content_length = body.length
 +      self.content_length = body.bytesize
        delete 'Transfer-Encoding'
        supply_default_content_type
        write_header sock, ver, path

Associated revisions

Revision 18518
Added by aamine (Minero Aoki) almost 4 years ago

* lib/net/http.rb (send_request_with_body): Content-Length should be byte length of string. (closes #203)

Revision 18518
Added by aamine (Minero Aoki) almost 4 years ago

* lib/net/http.rb (send_request_with_body): Content-Length should be byte length of string. (closes #203)

History

Updated by ko1 (Koichi Sasada) almost 4 years ago

  • Assignee set to aamine (Minero Aoki)

Updated by aamine (Minero Aoki) almost 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
Applied in changeset r18518.

Also available in: Atom PDF