hyperium / headers

Typed HTTP Headers from hyper
https://hyper.rs
MIT License
162 stars 84 forks source link

Make authorization schemes case and whitespace insensitive #153

Closed cole-h closed 9 months ago

cole-h commented 9 months ago

Closes https://github.com/hyperium/headers/pull/141. (Based on this PR, but moved to using std::slice::eq_ignore_ascii_case() which doesn't allocate or copy.) Partially addresses https://github.com/hyperium/headers/issues/112. (Does not validate that e.g. the token part of Bearer token contains valid token68 characters, however.)

cole-h commented 9 months ago

I tried to [patch.crates-io] this crate to the latest HEAD of this repo (when this PR is merged), but because I'm using axum 0.6.20, Cargo was having trouble version solving for the different requirements (axum doesn't yet support http 1.0, while this crate was bumped to http 1.0 in https://github.com/hyperium/headers/pull/151).

I created a branch with the http 1.0 bump reverted (https://github.com/cole-h/headers/tree/revert-http-1, current HEAD is https://github.com/cole-h/headers/commit/b691d512818f90a34722f3f0b2b2dcb81007fae9) and am able to use that just fine! In case anybody wants to use this with axum as well (until they release an update supporting http 1.0), feel free to use that branch / commit (or create your own!).