hyperium / headers

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

fix: avoid treating empty values as valid CSV input #165

Open miraclx opened 7 months ago

miraclx commented 7 months ago

While using Axum, I noticed If-Match & If-None-Match would always default to Some("") making it difficult to know if the user passed the headers as If-Match: or not at all.

I looked into the code, and it turns out the logic for consuming the values iterator defaults to an empty byte array (ergo, empty string)

I chose this peeking method and short-circuiting before calling collect to avoid more complex patterns.

And tags in If-Match & If-None-Match (depending on EntityTagRange) weren't being validated.

This fixes that.

paolobarbolini commented 7 months ago

This will also fix my issue #148