Project

General

Profile

Feature #6617 » net-http_bind_to_local_ip.patch

mksm (Ricardo Amorim), 06/26/2012 03:44 AM

View differences:

lib/net/http.rb
def initialize(address, port = nil)
@address = address
@port = (port || HTTP.default_port)
@local_host = nil
@local_port = nil
@curr_http_version = HTTPVersion
@keep_alive_timeout = 2
@last_communicated = nil
......
# The port number to connect to.
attr_reader :port
# The local host used to estabilish the connection.
attr_accessor :local_host
# The local port used to estabilish the connection.
attr_accessor :local_port
# Number of seconds to wait for the connection to open. Any number
# may be used, including Floats for fractional seconds. If the HTTP
# object cannot open a connection in this many seconds, it raises a
......
def connect
D "opening connection to #{conn_address()}..."
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
TCPSocket.open(conn_address(), conn_port())
TCPSocket.open(conn_address(), conn_port(), @local_host, @local_port)
}
D "opened"
if use_ssl?
(1-1/2)