Skip to content

Commit fdf6e46

Browse files
authored
fix: use default http transport for head (#926)
note: still disables TLS verification to enable use with local regisitries
1 parent d38e52b commit fdf6e46

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pkg/registry/digest/digest.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import (
1010
"github.com/containrrr/watchtower/pkg/registry/manifest"
1111
"github.com/containrrr/watchtower/pkg/types"
1212
"github.com/sirupsen/logrus"
13+
"net"
1314
"net/http"
1415
"strings"
16+
"time"
1517
)
1618

1719
// ContentDigestHeader is the key for the key-value pair containing the digest header
@@ -69,7 +71,17 @@ func TransformAuth(registryAuth string) string {
6971
// GetDigest from registry using a HEAD request to prevent rate limiting
7072
func GetDigest(url string, token string) (string, error) {
7173
tr := &http.Transport{
72-
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
74+
Proxy: http.ProxyFromEnvironment,
75+
DialContext: (&net.Dialer{
76+
Timeout: 30 * time.Second,
77+
KeepAlive: 30 * time.Second,
78+
}).DialContext,
79+
ForceAttemptHTTP2: true,
80+
MaxIdleConns: 100,
81+
IdleConnTimeout: 90 * time.Second,
82+
TLSHandshakeTimeout: 10 * time.Second,
83+
ExpectContinueTimeout: 1 * time.Second,
84+
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
7385
}
7486
client := &http.Client{Transport: tr}
7587

0 commit comments

Comments
 (0)