mirror of
https://github.com/caddyserver/caddy.git
synced 2026-10-08 23:18:24 +00:00
chore: Update quic-go to v0.41.0, bump Go minimum to 1.21 (#6043)
Co-authored-by: Francis Lavoie <lavofr@gmail.com> Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
parent
2fe69a828f
commit
697cc593a1
11 changed files with 56 additions and 85 deletions
|
|
@ -20,9 +20,7 @@ import (
|
|||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
|
@ -328,15 +326,9 @@ func (app *App) Provision(ctx caddy.Context) error {
|
|||
|
||||
// Validate ensures the app's configuration is valid.
|
||||
func (app *App) Validate() error {
|
||||
isGo120 := strings.Contains(runtime.Version(), "go1.20")
|
||||
|
||||
// each server must use distinct listener addresses
|
||||
lnAddrs := make(map[string]string)
|
||||
for srvName, srv := range app.Servers {
|
||||
if isGo120 && srv.EnableFullDuplex {
|
||||
app.logger.Warn("enable_full_duplex is not supported in Go 1.20, use a build made with Go 1.21 or later", zap.String("server", srvName))
|
||||
}
|
||||
|
||||
for _, addr := range srv.Listen {
|
||||
listenAddr, err := caddy.ParseNetworkAddress(addr)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright 2015 Matthew Holt and The Caddy Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !go1.21
|
||||
|
||||
package caddyhttp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func enableFullDuplex(w http.ResponseWriter) error {
|
||||
// Do nothing, Go 1.20 and earlier do not support full duplex
|
||||
return nil
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright 2015 Matthew Holt and The Caddy Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build go1.21
|
||||
|
||||
package caddyhttp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func enableFullDuplex(w http.ResponseWriter) error {
|
||||
//nolint:bodyclose
|
||||
return http.NewResponseController(w).EnableFullDuplex()
|
||||
}
|
||||
|
|
@ -19,7 +19,6 @@ import (
|
|||
"context"
|
||||
"crypto/ecdsa"
|
||||
"crypto/ed25519"
|
||||
"crypto/elliptic"
|
||||
"crypto/rsa"
|
||||
"crypto/sha256"
|
||||
"crypto/tls"
|
||||
|
|
@ -470,7 +469,11 @@ func marshalPublicKey(pubKey any) ([]byte, error) {
|
|||
case *rsa.PublicKey:
|
||||
return asn1.Marshal(key)
|
||||
case *ecdsa.PublicKey:
|
||||
return elliptic.Marshal(key.Curve, key.X, key.Y), nil
|
||||
e, err := key.ECDH()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return e.Bytes(), nil
|
||||
case ed25519.PublicKey:
|
||||
return key, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -302,9 +302,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
// enable full-duplex for HTTP/1, ensuring the entire
|
||||
// request body gets consumed before writing the response
|
||||
if s.EnableFullDuplex {
|
||||
// TODO: Remove duplex_go12*.go abstraction once our
|
||||
// minimum Go version is 1.21 or later
|
||||
err := enableFullDuplex(w)
|
||||
//nolint:bodyclose
|
||||
err := http.NewResponseController(w).EnableFullDuplex()
|
||||
if err != nil {
|
||||
s.accessLogger.Warn("failed to enable full duplex", zap.Error(err))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue