Feature #14339 ยป 0001-net-http-use-writev-for-HTTP-chunked-request-bodies.patch
lib/net/http/generic_request.rb | ||
---|---|---|
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
|
||
lib/net/protocol.rb | ||
---|---|---|
public
|
||
def write(str)
|
||
def write(*strs)
|
||
writing {
|
||
write0 str
|
||
write0 *strs
|
||
}
|
||
end
|
||
... | ... | |
bytes
|
||
end
|
||
def write0(str)
|
||
@debug_output << str.dump if @debug_output
|
||
len = @io.write(str)
|
||
def write0(*strs)
|
||
@debug_output << Array(strs).map(&:dump).join if @debug_output
|
||
len = @io.write(*strs)
|
||
@written_bytes += len
|
||
len
|
||
end
|
||
-
|