Merge "Fix ipv6 support"

This commit is contained in:
Jenkins 2015-03-30 18:46:27 +00:00 committed by Gerrit Code Review
commit bbeb24c51a

View File

@ -30,7 +30,13 @@ end
# A parsed URL (returned from URI.parse)
def handle_request(req, url)
begin
res = Net::HTTP.start(url.host, url.port) {|http|
# There is issue with ipv6 where address has to be in brackets, this causes the
# underlying ruby TCPSocket to fail. Net::HTTP.new will fail without brackets on
# joining the ipv6 address with :port or passing brackets to TCPSocket. It was
# found that if we use Net::HTTP.start with url.hostname the incriminated code
# won't be hit.
use_ssl = url.scheme == "https" ? true : false
res = Net::HTTP.start(url.hostname, url.port, {:use_ssl => use_ssl}) {|http|
http.request(req)
}