Fix transport port
This commit is contained in:
@@ -39,7 +39,7 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
||||
dialer := &net.Dialer{}
|
||||
transport := &http.Transport{
|
||||
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
host, _, err := net.SplitHostPort(addr)
|
||||
host, port, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -57,13 +57,12 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
||||
}
|
||||
}
|
||||
if ipv6 == nil { // No IPv6 address found, fallback to default
|
||||
r.log.Warnf("No IPv6 address found for %s, falling back to default", host)
|
||||
addr = net.JoinHostPort(host, req.URL.Port())
|
||||
addr = net.JoinHostPort(host, port)
|
||||
} else {
|
||||
addr = net.JoinHostPort(ipv6.String(), req.URL.Port())
|
||||
addr = net.JoinHostPort(ipv6.String(), port)
|
||||
}
|
||||
} else if ipv6 != nil && host == req.URL.Hostname() {
|
||||
addr = net.JoinHostPort(ipv6.String(), req.URL.Port())
|
||||
addr = net.JoinHostPort(ipv6.String(), port)
|
||||
}
|
||||
return dialer.DialContext(ctx, network, addr)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user