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

Header fields should be case insensitive (RFC 7230 §3.2, RFC 9110 §5.1)

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust
領域
api, networking

調査の方向性

まず、HeaderName::from_static と併せて HeaderMap::get および HeaderMap::insert の動作を調べ、issue にある大文字と小文字を区別する例を再現ケースとして使用します。完了条件は、ヘッダー名の取得で大文字と小文字の違いが受け入れられること、from_static が有効なフィールド名に対してパニックしなくなること、元の大文字と小文字が保持されることです。

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

説明

I'm working with http::HeaderMap and noticed that HeaderMap::get, HeaderMap::insert, and HeaderName::from_static all seem to be case sensitive (in fact, the latter panics:

HeaderName::from_static("Content-Type")

panics with:

index out of bounds: the len is 0 but the index is 0

while:

HeaderName::from_static("content-type")

does not.

This goes against the HTTP spec requiring case-insensitive handling of header values:

  • RFC 7230 §3.2

    Each header field consists of a case-insensitive field name followed by a colon (":"), optional leading whitespace, the field value, and optional trailing whitespace.

  • RFC 9110 §5.1

    Field names are case-insensitive...

IMO, this is distinct from #670, and in fact case-insensitive keys should solve that issue as well, while not requiring the original cases to be changed.

It looks like crates like case_insensitive_hashmap and unicase are examples of case-insensitive String handling.

Is there any way to just make the HeaderMap case-insensitive for retrieval? That would preserve original case as well as allow any case for HeaderMap::get to meet the spec and prevent errors.

主要言語
Rust
スター
1.4k
フォーク
380
平均マージ
2日 5時間
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

hyperium/http のほかの issue

hyperium/http の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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