From 054e23880483c1a51621aa2b8e67022376e283cc Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 8 Sep 2026 21:42:59 -0600 Subject: [PATCH] fix(httpcache): use fast internal HTTP client by default --- net/httpcache/go.mod | 7 +++++-- net/httpcache/go.sum | 2 ++ net/httpcache/httpcache.go | 9 +++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/net/httpcache/go.mod b/net/httpcache/go.mod index 8408a97..d98de41 100644 --- a/net/httpcache/go.mod +++ b/net/httpcache/go.mod @@ -1,5 +1,8 @@ module github.com/therootcompany/golib/net/httpcache -go 1.26.0 +go 1.26.5 -require golang.org/x/sync v0.20.0 +require ( + github.com/therootcompany/golib/https v0.9.0 + golang.org/x/sync v0.20.0 +) diff --git a/net/httpcache/go.sum b/net/httpcache/go.sum index 733d716..a8eecb1 100644 --- a/net/httpcache/go.sum +++ b/net/httpcache/go.sum @@ -1,2 +1,4 @@ +github.com/therootcompany/golib/https v0.9.0 h1:D9gh0K6ljkvF805JUbylITn8SHPMo08q5PglQGXsK8c= +github.com/therootcompany/golib/https v0.9.0/go.mod h1:ilExqR/Uh7oB36oy9mwuNhANcFh+zdCfD3uJiZ11YAY= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= diff --git a/net/httpcache/httpcache.go b/net/httpcache/httpcache.go index fcd5b18..9be1441 100644 --- a/net/httpcache/httpcache.go +++ b/net/httpcache/httpcache.go @@ -14,6 +14,7 @@ import ( "path/filepath" "time" + "github.com/therootcompany/golib/https" "golang.org/x/sync/singleflight" ) @@ -139,11 +140,11 @@ func (c *Cacher) saveMeta() error { return nil } -// New creates a Cacher with a default *http.Client (5s connect, 5m overall). -// Equivalent to NewWith(url, path, nil). Header is read live on every request, -// so it may be set or modified after New. +// New creates a Cacher with golib's fast internal HTTP client. +// Equivalent to NewWith(url, path, https.NewInternalClient()). Header is read +// live on every request, so it may be set or modified after New. func New(url, path string) *Cacher { - return NewWith(url, path, nil) + return NewWith(url, path, https.NewInternalClient()) } // NewWith creates a Cacher backed by the given *http.Client; pass nil for