@@ -614,32 +614,14 @@ func (s *Server) serveHTTP3(addr caddy.NetworkAddress, tlsCfg *tls.Config) error
614
614
// create HTTP/3 server if not done already
615
615
if s .h3server == nil {
616
616
s .h3server = & http3.Server {
617
- // Currently when closing a http3.Server, only listeners are closed. But caddy reuses these listeners
618
- // if possible, requests are still read and handled by the old handler. Close these connections manually.
619
- // see issue: https://github.com/caddyserver/caddy/issues/6195
620
- // Will interrupt ongoing requests.
621
- // TODO: remove the handler wrap after http3.Server.CloseGracefully is implemented, see App.Stop
622
- Handler : http .HandlerFunc (func (writer http.ResponseWriter , request * http.Request ) {
623
- select {
624
- case <- s .ctx .Done ():
625
- if quicConn , ok := request .Context ().Value (quicConnCtxKey ).(quic.Connection ); ok {
626
- //nolint:errcheck
627
- quicConn .CloseWithError (quic .ApplicationErrorCode (http3 .ErrCodeRequestRejected ), "" )
628
- }
629
- default :
630
- s .ServeHTTP (writer , request )
631
- }
632
- }),
617
+ Handler : s ,
633
618
TLSConfig : tlsCfg ,
634
619
MaxHeaderBytes : s .MaxHeaderBytes ,
635
620
QUICConfig : & quic.Config {
636
621
Versions : []quic.Version {quic .Version1 , quic .Version2 },
637
622
Tracer : qlog .DefaultConnectionTracer ,
638
623
},
639
624
IdleTimeout : time .Duration (s .IdleTimeout ),
640
- ConnContext : func (ctx context.Context , c quic.Connection ) context.Context {
641
- return context .WithValue (ctx , quicConnCtxKey , c )
642
- },
643
625
}
644
626
}
645
627
@@ -1099,10 +1081,6 @@ const (
1099
1081
// For referencing underlying net.Conn
1100
1082
ConnCtxKey caddy.CtxKey = "conn"
1101
1083
1102
- // For referencing underlying quic.Connection
1103
- // TODO: export if needed later
1104
- quicConnCtxKey caddy.CtxKey = "quic_conn"
1105
-
1106
1084
// For tracking whether the client is a trusted proxy
1107
1085
TrustedProxyVarKey string = "trusted_proxy"
1108
1086
0 commit comments