Set http transport config

This change sets the github client http transport options to mirror those
of the default transport from Go, with the addition of the TLSClientConfig.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-06-27 07:18:54 +00:00
parent 42839917f3
commit 529ce8b7a8

View file

@ -23,6 +23,7 @@ import (
"encoding/pem"
"fmt"
"math"
"net"
"net/http"
"time"
@ -912,11 +913,22 @@ func (g ForgeCredentials) GetHTTPClient(ctx context.Context) (*http.Client, erro
}
}
dialer := &net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}
httpTransport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: dialer.DialContext,
TLSClientConfig: &tls.Config{
RootCAs: roots,
MinVersion: tls.VersionTLS12,
},
ForceAttemptHTTP2: true,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
var tc *http.Client