mirror of
https://github.com/caddyserver/caddy.git
synced 2026-11-21 15:29:45 +00:00
build: bump all dependencies - (Go 1.26 floor) (#8056)
* build: bump deps * chore: note HTTP/2 migration follow-ups
This commit is contained in:
parent
5ee9a2d424
commit
90ccea768f
13 changed files with 336 additions and 352 deletions
|
|
@ -527,9 +527,9 @@ func (app *App) Start() error {
|
|||
// when h2c is enabled but h2 disabled, we already removed h2 from NextProtos
|
||||
// the handshake will never succeed with h2
|
||||
// http2.ConfigureServer will enable the server to handle both h2 and h2c
|
||||
h2server := new(http2.Server)
|
||||
//nolint:errcheck
|
||||
http2.ConfigureServer(srv.server, h2server)
|
||||
// TODO: Migrate to http.Server.Protocols once listener-wrapper behaviour is covered.
|
||||
//nolint:errcheck,staticcheck
|
||||
http2.ConfigureServer(srv.server, new(http2.Server))
|
||||
}
|
||||
|
||||
// this TLS config is used by the std lib to choose the actual TLS config for connections
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ import (
|
|||
// set will be populated.
|
||||
func Error(statusCode int, err error) HandlerError {
|
||||
const idLen = 9
|
||||
var he HandlerError
|
||||
if errors.As(err, &he) {
|
||||
if he, ok := errors.AsType[HandlerError](err); ok {
|
||||
if he.ID == "" {
|
||||
he.ID = randString(idLen, true)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -689,8 +689,7 @@ func (fsrv *FileServer) mapDirOpenError(fileSystem fs.FS, originalErr error, nam
|
|||
return originalErr
|
||||
}
|
||||
|
||||
var pathErr *fs.PathError
|
||||
if errors.As(originalErr, &pathErr) {
|
||||
if _, ok := errors.AsType[*fs.PathError](originalErr); ok {
|
||||
return fs.ErrInvalid
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,8 +204,7 @@ func (sa *StringArray) UnmarshalJSON(b []byte) error {
|
|||
// If err is a HandlerError, the returned values will
|
||||
// have richer information.
|
||||
func errLogValues(err error) (status int, msg string, fields func() []zapcore.Field) {
|
||||
var handlerErr HandlerError
|
||||
if errors.As(err, &handlerErr) {
|
||||
if handlerErr, ok := errors.AsType[HandlerError](err); ok {
|
||||
status = handlerErr.StatusCode
|
||||
if handlerErr.Err == nil {
|
||||
msg = err.Error()
|
||||
|
|
|
|||
|
|
@ -369,8 +369,7 @@ func (h *metricsInstrumentedRoute) ServeHTTP(w http.ResponseWriter, r *http.Requ
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
var handlerErr HandlerError
|
||||
if errors.As(err, &handlerErr) {
|
||||
if handlerErr, ok := errors.AsType[HandlerError](err); ok {
|
||||
observeRequest(handlerErr.StatusCode)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,8 +80,7 @@ type errorWrapper struct {
|
|||
|
||||
func (ew errorWrapper) Read(p []byte) (n int, err error) {
|
||||
n, err = ew.ReadCloser.Read(p)
|
||||
var mbe *http.MaxBytesError
|
||||
if errors.As(err, &mbe) {
|
||||
if _, ok := errors.AsType[*http.MaxBytesError](err); ok {
|
||||
err = caddyhttp.Error(http.StatusRequestEntityTooLarge, err)
|
||||
}
|
||||
return n, err
|
||||
|
|
|
|||
|
|
@ -533,6 +533,8 @@ func (h *HTTPTransport) NewTransport(caddyCtx caddy.Context) (*http.Transport, e
|
|||
|
||||
// if h2/c is enabled, configure it explicitly
|
||||
if slices.Contains(h.Versions, "2") || slices.Contains(h.Versions, "h2c") {
|
||||
// TODO: Migrate to http.Transport.Protocols once transport behaviour is covered.
|
||||
//nolint:staticcheck
|
||||
if err := http2.ConfigureTransport(rt); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -499,8 +499,7 @@ func (t *Templates) executeTemplate(rr caddyhttp.ResponseRecorder, r *http.Reque
|
|||
if err != nil {
|
||||
// templates may return a custom HTTP error to be propagated to the client,
|
||||
// otherwise for any other error we assume the template is broken
|
||||
var handlerErr caddyhttp.HandlerError
|
||||
if errors.As(err, &handlerErr) {
|
||||
if handlerErr, ok := errors.AsType[caddyhttp.HandlerError](err); ok {
|
||||
return handlerErr
|
||||
}
|
||||
return caddyhttp.Error(http.StatusInternalServerError, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue