You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Connection header lets me test if it contains specific "connection options"1 are contained in it. But it doesn't let me actually iterate its contents to see what it contains.
This is very frustrating as I need to actually know what's in the header because I'm implementing a gateway and I need to strip the referenced header names from the request I'm proxying. I would really like to be able to use headers::Connection so I don't have to worry about parsing the comma-separated list myself.
In theory I could just parse the header and then walk the whole headers map and compare each entry to the Connection, except HeaderMap does not offer a retain() operation and so that approach would require reallocating the whole map even if I don't end up making any changes.
Footnotes
This is represented as a private impl AsConnectionOption type, which means it's undocumented. Really that should be changed so AsConnectionOption is public and simply inherits from a sealed trait, so the generated docs will at least tell me what implements it. Or maybe change it to use impl AsRef<str> instead, or even impl AsRef<[u8]> as that supports the required comparison too. ↩
The text was updated successfully, but these errors were encountered:
We could come up with an fn iter(&self) -> impl Iterator (what would the items be? &str?). Would you like to propose that and send a PR?
which means it's undocumented. Really that should be changed
But it's not undocumented, the documentation for the contains method lists exactly what types can be passed. So, I don't think it will be changed.
This is very frustrating
Is it frustrating? If so, I'm sorry about that. However, a missing function shouldn't typically be frustrating. It's just something that would be nice to add. I'd recommend trying to frame feature requests in a positive way.
The
Connection
header lets me test if it contains specific "connection options"1 are contained in it. But it doesn't let me actually iterate its contents to see what it contains.This is very frustrating as I need to actually know what's in the header because I'm implementing a gateway and I need to strip the referenced header names from the request I'm proxying. I would really like to be able to use
headers::Connection
so I don't have to worry about parsing the comma-separated list myself.In theory I could just parse the header and then walk the whole headers map and compare each entry to the
Connection
, exceptHeaderMap
does not offer aretain()
operation and so that approach would require reallocating the whole map even if I don't end up making any changes.Footnotes
This is represented as a private
impl AsConnectionOption
type, which means it's undocumented. Really that should be changed soAsConnectionOption
is public and simply inherits from a sealed trait, so the generated docs will at least tell me what implements it. Or maybe change it to useimpl AsRef<str>
instead, or evenimpl AsRef<[u8]>
as that supports the required comparison too. ↩The text was updated successfully, but these errors were encountered: