Sha256: a641c982c08eaba50de4aa25b5276d35913b896be07876d30ff5057b9035e8a8
Contents?: true
Size: 1.61 KB
Versions: 10
Compression:
Stored size: 1.61 KB
Contents
# frozen_string_literal: true require 'net/http' if RUBY_VERSION == '1.8.7' module ::Net #:nodoc: class HTTP < Protocol def connect D "opening connection to #{conn_address()}..." s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) } D "opened" if use_ssl? unless @ssl_context.verify_mode warn "warning: peer certificate won't be verified in this SSL session" @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE end s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context) s.sync_close = true end @socket = BufferedIO.new(s) @socket.read_timeout = @read_timeout @socket.debug_output = @debug_output if use_ssl? if proxy? @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', @address, @port, HTTPVersion) @socket.writeline "Host: #{@address}:#{@port}" if proxy_user credential = ["#{proxy_user}:#{proxy_pass}"].pack('m') credential.delete!("\r\n") @socket.writeline "Proxy-Authorization: Basic #{credential}" end @socket.writeline '' HTTPResponse.read_new(@socket).value end # NOTE: Change here. This was just s.connect, now we have added a timeout. timeout(@open_timeout) { s.connect } if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE s.post_connection_check(@address) end end on_connect end private :connect end end end
Version data entries
10 entries across 10 versions & 1 rubygems