Support WebSockets over HTTP/2 via RFC 8441 Extended CONNECT
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- scala
- 領域
- api, backend, networking
調査の方向性
まず既存の WebSocketUpgrade API と handleWebSocketMessages API を確認し、RFC 8441 に照らして HTTP/2 の処理を追跡します。SETTINGS_ENABLE_CONNECT_PROTOCOL、Extended CONNECT、HTTP/2 status 200、フレームフロー、ストリームの終了を既存の WebSocket メッセージスタックにどのように統合するかを定義します。完了条件は、合意された API とサーバー側の動作があり、受け入れられた HTTP/2 WebSocket ストリームと終了した HTTP/2 WebSocket ストリームがカバーされていることです。
索引モデルが issue の本文から書いたものです。
説明
Problem
Pekko HTTP supports HTTP/2 and WebSockets, but WebSocket support currently appears to be limited to the classic HTTP/1.1 upgrade handshake.
RFC 8441 defines how to bootstrap WebSockets over HTTP/2 using Extended CONNECT:
- server advertises
SETTINGS_ENABLE_CONNECT_PROTOCOL = 1 - client sends
:method = CONNECT - client sends
:protocol = websocket - request also includes
:scheme,:path, and:authority - server accepts with
:status = 200 - WebSocket frames are then carried over the HTTP/2 stream
This would allow applications to serve HTTP/2 requests and WebSockets on the same HTTP/2 connection instead of falling back to a separate HTTP/1.1 WebSocket upgrade connection.
RFC: https://www.rfc-editor.org/rfc/rfc8441.html
Current Behavior
Pekko HTTP WebSocket handling is based on the HTTP/1.1 upgrade model:
- request validation expects
Upgrade: websocket,Connection: Upgrade,Sec-WebSocket-Key, andSec-WebSocket-Version - accepted WebSockets return
101 Switching Protocols - the existing
WebSocketUpgradeAPI represents upgrading the connection to WebSocket
That matches RFC 6455 over HTTP/1.1, but not RFC 8441 over HTTP/2.
Expected Behavior
When HTTP/2 is enabled, Pekko HTTP should optionally support RFC 8441 WebSockets over HTTP/2.
At a high level this likely means:
- advertise
SETTINGS_ENABLE_CONNECT_PROTOCOL = 1when server-side support is enabled - accept HTTP/2 Extended CONNECT requests with
:protocol = websocket - expose those requests to routing / low-level APIs similarly to existing WebSocket upgrade requests
- allow existing
handleWebSocketMessages/WebSocketUpgradestyle APIs to work where practical - respond with HTTP/2
:status = 200when the WebSocket is accepted - connect the existing WebSocket frame/message stack to the HTTP/2 stream DATA flow
- map HTTP/2 stream end/reset/failure semantics sensibly to WebSocket close behavior
Motivation
Modern browsers support WebSockets over HTTP/2 via RFC 8441. Supporting this in Pekko HTTP would allow one server port and one HTTP/2 connection to handle both normal HTTP traffic and WebSockets.
This is useful for frameworks built on Pekko HTTP as well. For example, Play Framework can enable HTTP/2 on its Pekko HTTP backend, but WebSocket support still depends on the HTTP/1.1 upgrade path because Pekko HTTP does not currently expose RFC 8441 WebSocket support.
Notes
Netty has already added several low-level RFC 8441 building blocks, but still tracks high-level WebSocket-over-HTTP/2 support as an open feature request:
- https://github.com/netty/netty/issues/8011
- https://github.com/netty/netty/issues/12352
- https://github.com/netty/netty/pull/11192
- https://github.com/netty/netty/pull/14995
- https://github.com/netty/netty/pull/15312
- https://github.com/netty/netty/pull/16932
A third-party Netty implementation also exists:
Questions
- Would the Pekko HTTP project be open to RFC 8441 server-side support?
- Should this be implemented behind an explicit config flag, for example under
pekko.http.server.websocketorpekko.http.server.http2? - Should the existing
WebSocketUpgradeAPI be reused for HTTP/2 Extended CONNECT, or should there be a separate API to distinguish HTTP/1.1 upgrade from HTTP/2 stream-based WebSocket bootstrap?
- 主要言語
- Scala
- スター
- 196
- フォーク
- 56
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 43
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/pekko-http のほかの issue
-
dependencies
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
apache/pekko-http#1354 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
apache/pekko-http#1273 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
apache/pekko-http#1249 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
apache/pekko-http#1248 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
apache/pekko-http#1180 ·
メンテナーはふだん 1 日以内に返信
apache/pekko-http の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
scylladb/scylla-migrator#413 ·
-
難易度 2/5 1時間未満 初心者へのやさしさ 70/100
-
[Bug] HiveDialect shares its colspecs dict with SQLAlchemy's DefaultDialect (python/pyhive)対応中かも @rusackas が 1 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
apache/kyuubi#7786 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
ST_AddMeasure assigns incorrect measures on bent lines and MultiLineStrings対応中かも @vera-rubin が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信