diff options
| author | Marten Seemann <martenseemann@gmail.com> | 2023-07-21 21:00:48 -0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-21 22:00:48 -0600 | 
| commit | f45a6de20dd19e82e58c85b37e03957b2203b544 (patch) | |
| tree | cc8152b73fd31c09111dfb0034960a0c20d6ff67 /modules | |
| parent | b51dc5d5d0b8764165170af1f54b77d6de8cb5a1 (diff) | |
go.mod: Update quic-go to v0.37.0, bump to Go 1.20 minimum (#5644)
* update quic-go to v0.37.0
* Bump to Go 1.20
* Bump golangci-lint version, yml syntax consistency
* Use skip-pkg-cache workaround
* Workaround needed for both?
* Seeding weakrand is no longer necessary
---------
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/caddyhttp/caddyauth/basicauth.go | 3 | ||||
| -rw-r--r-- | modules/caddyhttp/errors.go | 5 | ||||
| -rw-r--r-- | modules/caddyhttp/fileserver/staticfiles.go | 3 | ||||
| -rw-r--r-- | modules/caddyhttp/reverseproxy/reverseproxy.go | 39 | ||||
| -rw-r--r-- | modules/caddyhttp/reverseproxy/selectionpolicies.go | 3 | 
5 files changed, 15 insertions, 38 deletions
| diff --git a/modules/caddyhttp/caddyauth/basicauth.go b/modules/caddyhttp/caddyauth/basicauth.go index f515a72..6cd38a5 100644 --- a/modules/caddyhttp/caddyauth/basicauth.go +++ b/modules/caddyhttp/caddyauth/basicauth.go @@ -23,7 +23,6 @@ import (  	"net/http"  	"strings"  	"sync" -	"time"  	"github.com/caddyserver/caddy/v2"  	"golang.org/x/sync/singleflight" @@ -31,8 +30,6 @@ import (  func init() {  	caddy.RegisterModule(HTTPBasicAuth{}) - -	weakrand.Seed(time.Now().UnixNano())  }  // HTTPBasicAuth facilitates HTTP basic authentication. diff --git a/modules/caddyhttp/errors.go b/modules/caddyhttp/errors.go index 9d1cf47..1538d43 100644 --- a/modules/caddyhttp/errors.go +++ b/modules/caddyhttp/errors.go @@ -20,15 +20,10 @@ import (  	"path"  	"runtime"  	"strings" -	"time"  	"github.com/caddyserver/caddy/v2"  ) -func init() { -	weakrand.Seed(time.Now().UnixNano()) -} -  // Error is a convenient way for a Handler to populate the  // essential fields of a HandlerError. If err is itself a  // HandlerError, then any essential fields that are not diff --git a/modules/caddyhttp/fileserver/staticfiles.go b/modules/caddyhttp/fileserver/staticfiles.go index f335d31..3261093 100644 --- a/modules/caddyhttp/fileserver/staticfiles.go +++ b/modules/caddyhttp/fileserver/staticfiles.go @@ -29,7 +29,6 @@ import (  	"runtime"  	"strconv"  	"strings" -	"time"  	"github.com/caddyserver/caddy/v2"  	"github.com/caddyserver/caddy/v2/modules/caddyhttp" @@ -38,8 +37,6 @@ import (  )  func init() { -	weakrand.Seed(time.Now().UnixNano()) -  	caddy.RegisterModule(FileServer{})  } diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go index 2fd0aae..d1c9352 100644 --- a/modules/caddyhttp/reverseproxy/reverseproxy.go +++ b/modules/caddyhttp/reverseproxy/reverseproxy.go @@ -27,7 +27,6 @@ import (  	"net/netip"  	"net/textproto"  	"net/url" -	"runtime"  	"strconv"  	"strings"  	"sync" @@ -43,13 +42,7 @@ import (  	"golang.org/x/net/http/httpguts"  ) -var supports1xx bool -  func init() { -	// Caddy requires at least Go 1.18, but Early Hints requires Go 1.19; thus we can simply check for 1.18 in version string -	// TODO: remove this once our minimum Go version is 1.19 -	supports1xx = !strings.Contains(runtime.Version(), "go1.18") -  	caddy.RegisterModule(Handler{})  } @@ -752,25 +745,23 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, origRe  	server := req.Context().Value(caddyhttp.ServerCtxKey).(*caddyhttp.Server)  	shouldLogCredentials := server.Logs != nil && server.Logs.ShouldLogCredentials -	if supports1xx { -		// Forward 1xx status codes, backported from https://github.com/golang/go/pull/53164 -		trace := &httptrace.ClientTrace{ -			Got1xxResponse: func(code int, header textproto.MIMEHeader) error { -				h := rw.Header() -				copyHeader(h, http.Header(header)) -				rw.WriteHeader(code) - -				// Clear headers coming from the backend -				// (it's not automatically done by ResponseWriter.WriteHeader() for 1xx responses) -				for k := range header { -					delete(h, k) -				} +	// Forward 1xx status codes, backported from https://github.com/golang/go/pull/53164 +	trace := &httptrace.ClientTrace{ +		Got1xxResponse: func(code int, header textproto.MIMEHeader) error { +			h := rw.Header() +			copyHeader(h, http.Header(header)) +			rw.WriteHeader(code) + +			// Clear headers coming from the backend +			// (it's not automatically done by ResponseWriter.WriteHeader() for 1xx responses) +			for k := range header { +				delete(h, k) +			} -				return nil -			}, -		} -		req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace)) +			return nil +		},  	} +	req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))  	// if FlushInterval is explicitly configured to -1 (i.e. flush continuously to achieve  	// low-latency streaming), don't let the transport cancel the request if the client diff --git a/modules/caddyhttp/reverseproxy/selectionpolicies.go b/modules/caddyhttp/reverseproxy/selectionpolicies.go index f89c48f..bc6de35 100644 --- a/modules/caddyhttp/reverseproxy/selectionpolicies.go +++ b/modules/caddyhttp/reverseproxy/selectionpolicies.go @@ -27,7 +27,6 @@ import (  	"strconv"  	"strings"  	"sync/atomic" -	"time"  	"github.com/caddyserver/caddy/v2"  	"github.com/caddyserver/caddy/v2/caddyconfig" @@ -48,8 +47,6 @@ func init() {  	caddy.RegisterModule(QueryHashSelection{})  	caddy.RegisterModule(HeaderHashSelection{})  	caddy.RegisterModule(CookieHashSelection{}) - -	weakrand.Seed(time.Now().UTC().UnixNano())  }  // RandomSelection is a policy that selects | 
