mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-24 02:02:26 -04:00
fix handling for h2c
This commit is contained in:
parent
16e184af16
commit
6c1d6b06b4
@ -552,6 +552,7 @@ func (app *App) Start() error {
|
||||
// check if the connection is h2c
|
||||
ln = &http2Listener{
|
||||
useTLS: useTLS,
|
||||
useH2C: h2cok,
|
||||
Listener: ln,
|
||||
logger: app.logger,
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ type connectionStater interface {
|
||||
// wrapper authors will hopefully implement it.
|
||||
type http2Listener struct {
|
||||
useTLS bool
|
||||
useH2C bool
|
||||
net.Listener
|
||||
logger *zap.Logger
|
||||
}
|
||||
@ -52,6 +53,13 @@ func (h *http2Listener) Accept() (net.Conn, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
if h.useH2C {
|
||||
return &http2Conn{
|
||||
idx: len(http2.ClientPreface),
|
||||
Conn: conn,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return &http2Conn{
|
||||
Conn: conn,
|
||||
}, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user