mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-31 20:24:18 -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
|
// check if the connection is h2c
|
||||||
ln = &http2Listener{
|
ln = &http2Listener{
|
||||||
useTLS: useTLS,
|
useTLS: useTLS,
|
||||||
|
useH2C: h2cok,
|
||||||
Listener: ln,
|
Listener: ln,
|
||||||
logger: app.logger,
|
logger: app.logger,
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ type connectionStater interface {
|
|||||||
// wrapper authors will hopefully implement it.
|
// wrapper authors will hopefully implement it.
|
||||||
type http2Listener struct {
|
type http2Listener struct {
|
||||||
useTLS bool
|
useTLS bool
|
||||||
|
useH2C bool
|
||||||
net.Listener
|
net.Listener
|
||||||
logger *zap.Logger
|
logger *zap.Logger
|
||||||
}
|
}
|
||||||
@ -52,6 +53,13 @@ func (h *http2Listener) Accept() (net.Conn, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if h.useH2C {
|
||||||
|
return &http2Conn{
|
||||||
|
idx: len(http2.ClientPreface),
|
||||||
|
Conn: conn,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
return &http2Conn{
|
return &http2Conn{
|
||||||
Conn: conn,
|
Conn: conn,
|
||||||
}, nil
|
}, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user