Header fields should be case insensitive (RFC 7230 §3.2, RFC 9110 §5.1)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- rust
- Ambito
- api, networking
Direzione di ricerca
Inizia esaminando il comportamento di HeaderMap::get e HeaderMap::insert insieme a HeaderName::from_static, usando come riproduzione gli esempi nell’issue sensibili alle maiuscole e minuscole. Il lavoro è completato quando il recupero dei nomi degli header accetta maiuscole e minuscole diverse, from_static non va più in panic per i nomi di campo validi e viene mantenuta la capitalizzazione originale.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 1.4k
- Fork
- 378
- Merge medio
- 1g 21h
- PR unite (30g)
- 5
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di hyperium/http
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
Tutte le issue di hyperium/http
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
BurntSushi/jiff#653 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ZcashFoundation/zeeder#106 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
oxidize-rb/rb-sys#807 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
todo:ticket
Difficoltà 2/5 1-2 giorni Idoneità per principianti 74/100