Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

WebSocket: Request wrappers break the Servlet header contract (case-sensitive lookup, single-use enumerations)

オープン
#1,688 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@reiern70 がすでに取り組んでいます。

2026年10月19日 から。

  • #1689 @reiern70 による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
api, backend

調査の方向性

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 HashMap keyed by the original name.
  • Lets getHeader consume the enumeration via nextElement(), so a second call returns null.
  • 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/wicket のほかの issue

apache/wicket の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。