From 0fdea17c91d98f7ed68b7d110a4422a64f1e0aa7 Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Sat, 25 Nov 2023 16:14:32 +0100 Subject: [PATCH] Fix transport port --- pkg/http/client.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/http/client.go b/pkg/http/client.go index 95e7901..8311a10 100644 --- a/pkg/http/client.go +++ b/pkg/http/client.go @@ -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) },