hyperium / http

Rust HTTP types
Apache License 2.0
1.17k stars 294 forks source link

structured headers #475

Open fimbault opened 3 years ago

fimbault commented 3 years ago

Hi, any plan to include support for parsing and serializing structured headers? (RFC8941)

seanmonstar commented 3 years ago

Hey there! What specifically do you think the http crate would need to do? For turning HTTP headers into stronger Rust types, there's https://docs.rs/headers.

fimbault commented 3 years ago

Hi, Thanks for pointing that out. Indeed that's a good starting point to implement the structured fields (item, list, dict). There might be a few differences to take into account, as the usage is a bit different compared to common headers:

seanmonstar commented 3 years ago

Are either of those needed for this specific issue? Or can they be tracked in those existing issues?

My original question is if there's anything specific we need to do to support structured fields? I think after reading through that RFC, we don't need to do anything here. It's more a way for a user to decide how to parse a header value, which we provide as a byte string. Is that right?

fimbault commented 3 years ago

Probably yes. Mostly for hyper, the decision is to either include this in the core http library, or keep it separate. Same issue as in the go community.

The other issues can live separately, would probably help if resolved (for convenience and perf) but are not mandatory to get forward.

06chaynes commented 2 years ago

Crossposting here for reference https://github.com/http-rs/http-types/issues/344#issuecomment-1032804690

https://github.com/undef1nd/sfv

https://docs.rs/sfv/0.9.2/sfv