Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyper::header::Cookie not hashable #1139

Closed
dorfsmay opened this issue Apr 15, 2017 · 4 comments
Closed

hyper::header::Cookie not hashable #1139

dorfsmay opened this issue Apr 15, 2017 · 4 comments

Comments

@dorfsmay
Copy link
Contributor

From what I can see hyper::header::Cookie provides cookies as separate "key=value" element, but there is no way to access the keys directly (let me know if I'm missing something here). I think there would be value to provide a way to access Cookies directly bye keys right in hyper rather than as a separate crate.

Are there reasons for not providing this? Is it worth adding a PR for it? Should this be done as part of hyper::header::Cookie, or as a separate struct (say hyper::header::hashedCookie)?

@seanmonstar
Copy link
Member

I assume you mean that there isn't a way to store and access cookies by their name. That's correct, it is likely out of scope for hyper. There is a lot of good work in the cookie crate.

@dorfsmay
Copy link
Contributor Author

Cookies are key to web server/client communication.

I agree that session management, keeping track of cookies etc... is out of scope for hyper, and as noted the cookie crate does a great job for this. But I think that any apps running on top of a web server will eventually need to look at cookies from requests, for all kind of reasons, and for things simpler than session management. If splitting on the equal sign and provide a map to the cookies is out of scope, why wasn't splitting on the semi-colon and provide individual cookie "strings" not out of scope.

The effort to add this seems minimal, it's basically one struct and a couple of methods,. I'm happy to add a PR for this. Let me know your thoughts.

@seanmonstar
Copy link
Member

Hyper actually used to depend on the cookie crate, and so you would have Cookie structs that you could poke at. The dependency was removed because cookie had an optional dependency of openssl, which caused a lot of problems. I recall discussion of eventually removing that.

I wouldn't say that parsing the cookie string into a struct with name and value and such is necessarily out of scope, but anything more than that likely is.

@dorfsmay
Copy link
Contributor Author

This is being revisted in #1145.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants