Skip to content

Commit

Permalink
Merge pull request #176 from jsherwood0/ip6-sockets-1
Browse files Browse the repository at this point in the history
Strip square brackets when creating IPv6 sockets
  • Loading branch information
Hiroshi Nakamura committed Dec 2, 2013
2 parents d78643b + 8838897 commit aec91c1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/httpclient/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -797,12 +797,14 @@ def create_socket(site)
socket = nil
begin
@debug_dev << "! CONNECT TO #{site.host}:#{site.port}\n" if @debug_dev
clean_host = site.host.delete("[]")
clean_local = @socket_local.host.delete("[]")
if str = @test_loopback_http_response.shift
socket = LoopBackSocket.new(site.host, site.port, str)
socket = LoopBackSocket.new(clean_host, site.port, str)
elsif @socket_local == Site::EMPTY
socket = TCPSocket.new(site.host, site.port)
socket = TCPSocket.new(clean_host, site.port)
else
socket = TCPSocket.new(site.host, site.port, @socket_local.host, @socket_local.port)
socket = TCPSocket.new(clean_host, site.port, clean_local, @socket_local.port)
end
if @debug_dev
@debug_dev << "! CONNECTION ESTABLISHED\n"
Expand Down

0 comments on commit aec91c1

Please sign in to comment.