Feature #11056 » 0001-lib-net-use-io-wait-methods-instead-of-IO.select.patch
| lib/net/http/generic_request.rb | ||
|---|---|---|
|
def wait_for_continue(sock, ver)
|
||
|
if ver >= '1.1' and @header['expect'] and
|
||
|
@header['expect'].include?('100-continue')
|
||
|
if IO.select([sock.io], nil, nil, sock.continue_timeout)
|
||
|
if sock.io.to_io.wait_readable(sock.continue_timeout)
|
||
|
res = Net::HTTPResponse.read_new(sock)
|
||
|
unless res.kind_of?(Net::HTTPContinue)
|
||
|
res.decode_content = @decode_content
|
||
| lib/net/protocol.rb | ||
|---|---|---|
|
require 'socket'
|
||
|
require 'timeout'
|
||
|
require 'io/wait'
|
||
|
module Net # :nodoc:
|
||
| ... | ... | |
|
when String
|
||
|
return @rbuf << rv
|
||
|
when :wait_readable
|
||
|
IO.select([@io], nil, nil, @read_timeout) or raise Net::ReadTimeout
|
||
|
@io.to_io.wait_readable(@read_timeout) or raise Net::ReadTimeout
|
||
|
# continue looping
|
||
|
when :wait_writable
|
||
|
# OpenSSL::Buffering#read_nonblock may fail with IO::WaitWritable.
|
||
|
# http://www.openssl.org/support/faq.html#PROG10
|
||
|
IO.select(nil, [@io], nil, @read_timeout) or raise Net::ReadTimeout
|
||
|
@io.to_io.wait_writable(@read_timeout) or raise Net::ReadTimeout
|
||
|
# continue looping
|
||
|
when nil
|
||
|
# callers do not care about backtrace, so avoid allocating for it
|
||
|
-
|
||