HTTP header list parsing does not accept empty list elements

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

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

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
scala

調査の方向性

Start with the list parsing rules used by HttpHeader.parse and compare them with Range’s existing handling of leading empty elements. Check downstream handling of unrecognized Connection headers, especially whether close is honored. Done when leading, interior, and trailing empty elements parse as required across list headers, the all-empty case is decided for required lists, and tests cover these cases.

索引モデルが issue の本文から書いたものです。

説明

RFC 9110 §5.6.1 (previously RFC 7230 §7) says a recipient must parse and ignore a reasonable number of empty list elements. Most header list rules use oneOrMore(...).separatedBy(listSep) or the zeroOrMore equivalent, which does not allow them, so these headers are not parsed into their modeled types and stay RawHeaders:

Header Value
Cache-Control no-store,, public
Cache-Control , no-store, public
Cache-Control no-store, public,
Connection close,, foo
Allow GET,, POST
If-None-Match "a",, "b"
Accept text/plain,, text/html

These were found by parsing each value with HttpHeader.parse. They are a sample, and other headers using the same rules are likely to behave the same way. Range already tolerates leading empty elements with zeroOrMore(ws(',')).

Things to look at:

  • Interior, leading and trailing empty elements all need handling, so this probably means changing each list rule or adding a shared helper, not only listSep.
  • Decide how a list with no elements at all (for example Cache-Control: ,) should behave for headers that require at least one.
  • Check what happens downstream when a header stays a RawHeader, starting with Connection, since a close that is not recognised could change connection handling.

Follow-up to #1395, which fixes whitespace before the list separator but does not change how empty elements are handled.

主要言語
Scala
スター
199
フォーク
57
平均マージ
1日 20時間
マージ済み PR(30日)
54

環境構築

はじめの一歩

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

apache/pekko-http のほかの issue

apache/pekko-http の issue をすべて見る

似ている issue

Scala の issue をもっと見る

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

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