def query(req)
connect if @state == :INIT
req.header.request_via_proxy = !@proxy.nil?
begin
timeout(@send_timeout, SendTimeoutError) do
set_header(req)
req.dump(@socket)
@socket.flush unless @socket_sync
end
rescue Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE
close
raise KeepAliveDisconnected.new
rescue HTTPClient::TimeoutError
close
raise
rescue
if SSLEnabled and $!.is_a?(OpenSSL::SSL::SSLError)
raise KeepAliveDisconnected.new
else
raise
end
end
@state = :META if @state == :WAIT
@next_connection = nil
@requests.push(req)
end