WebSocket: Request wrappers break the Servlet header contract (case-sensitive lookup, single-use enumerations)
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Start by reading ServletRequestCopy and JavaxUpgradeHttpRequest, then inspect the tests for request headers and locales. Reproduce the case-insensitive lookup and repeated enumeration failures described in the issue. Done means both wrappers return case-insensitive header values through fresh, non-null enumerations, and copied locales can be read repeatedly.
索引モデルが issue の本文から書いたものです。
説明
Issue
ServletRequestCopy is used as an HttpServletRequest after the WebSocket handshake (AbstractWebSocketProcessor / IWebSocketConnectionFilter, and later frames via WebSocketSettings.newWebSocketRequest). It does not honour the Servlet spec for headers: names must be looked up case-insensitively, 'getHeaders' must return an empty Enumeration when absent, and repeated reads must return the same values.
ServletRequestCopy currently:
- Looks up with
headers.get(name), so "Origin" misses "origin" (HTTP/2 and many proxies send lowercase names). - Stores the original request's live Enumeration in a
HashMapkeyed by the original name. - Lets
getHeaderconsume the enumeration vianextElement(), so a second call returnsnull. getLocales()has the same single-use enumeration problem.
JavaxUpgradeHttpRequest has the same case-sensitive map and can return null from getHeaders / getHeaderNames.
Reproduction
MockHttpServletRequest original = new MockHttpServletRequest();
original.addHeader("user-agent", "TestAgent/1.0");
ServletRequestCopy copy = new ServletRequestCopy(original);
assertEquals("TestAgent/1.0", copy.getHeader("User-Agent")); // fails: case
assertEquals("TestAgent/1.0", copy.getHeader("User-Agent")); // fails: consumed
assertTrue(copy.getHeaders("User-Agent").hasMoreElements());
assertTrue(copy.getHeaders("User-Agent").hasMoreElements()); // fails: spent / null
Proposed fix
In ServletRequestCopy and JavaxUpgradeHttpRequest, store Map<String, List<String>> (e.g. TreeMap with String.CASE_INSENSITIVE_ORDER), materialise values at copy time, return a fresh enumeration from getHeaders (never null), and copy getLocales() the same way.
Fixing the copy itself covers both the processor and newWebSocketRequest.
Happy to send a PR once this issue is accepted.
- 主要言語
- Java
- スター
- 797
- フォーク
- 416
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 43
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/wicket のほかの issue
-
COOP and COEP exemptions compare with the context path, so page exemptions never match対応中かも @VelpulaGangavardhan が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
apache/wicket#1661 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
The CSP report-uri is lost in development mode because strict() clears it対応中かも @VelpulaGangavardhan が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/wicket#1660 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/wicket#1567 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Quickstart: mvn jetty:run has no SLF4J back end after slf4j-simple moved to test scope対応中かも @dashorst が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 30/100
apache/wicket#1690 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
QuiltMC/update-quilt-meta#28 ·
-
awaiting triage Documentation P3
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
area/build area/maintainability component/camunda-process-test kind/tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToList対応中かも @mohamed-elbrik が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
area/kotlin
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信