diff options
-rw-r--r-- | lib/net/http/generic_request.rb | 5 | ||||
-rw-r--r-- | lib/net/protocol.rb | 10 |
2 files changed, 7 insertions, 8 deletions
diff --git a/lib/net/http/generic_request.rb b/lib/net/http/generic_request.rb index 526cc333fc..a78ec16431 100644 --- a/lib/net/http/generic_request.rb +++ b/lib/net/http/generic_request.rb @@ -168,9 +168,8 @@ class Net::HTTPGenericRequest def write(buf) # avoid memcpy() of buf, buf can huge and eat memory bandwidth - @sock.write("#{buf.bytesize.to_s(16)}\r\n") - rv = @sock.write(buf) - @sock.write("\r\n") + rv = buf.bytesize + @sock.write("#{rv.to_s(16)}\r\n", buf, "\r\n") rv end diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index 380d31ed5d..e6994477b8 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -209,9 +209,9 @@ module Net # :nodoc: public - def write(str) + def write(*strs) writing { - write0 str + write0 *strs } end @@ -235,9 +235,9 @@ module Net # :nodoc: bytes end - def write0(str) - @debug_output << str.dump if @debug_output - len = @io.write(str) + def write0(*strs) + @debug_output << strs.map(&:dump).join if @debug_output + len = @io.write(*strs) @written_bytes += len len end |