Skip to content

Commit b1e8ece

Browse files
committed
fix handling for h2c
1 parent f372cc1 commit b1e8ece

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

modules/caddyhttp/app.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ func (app *App) Start() error {
552552
// check if the connection is h2c
553553
ln = &http2Listener{
554554
useTLS: useTLS,
555+
useH2C: h2cok,
555556
Listener: ln,
556557
logger: app.logger,
557558
}

modules/caddyhttp/http2listener.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type connectionStater interface {
2323
// wrapper authors will hopefully implement it.
2424
type http2Listener struct {
2525
useTLS bool
26+
useH2C bool
2627
net.Listener
2728
logger *zap.Logger
2829
}
@@ -52,6 +53,13 @@ func (h *http2Listener) Accept() (net.Conn, error) {
5253
}, nil
5354
}
5455

56+
if h.useH2C {
57+
return &http2Conn{
58+
idx: len(http2.ClientPreface),
59+
Conn: conn,
60+
}, nil
61+
}
62+
5563
return &http2Conn{
5664
Conn: conn,
5765
}, nil

0 commit comments

Comments
 (0)