Crate cookie [−] [src]
HTTP Cookie parsing and Cookie Jar management.
This crates provides the Cookie type, which directly maps to an HTTP cookie, and the CookieJar type, which allows for simple management of many cookies as well as encryption and signing of cookies for session management.
Usage
Add the following to the [dependencies] section of your Cargo.toml:
cookie = "0.6"
Then add the following line to your crate root:
extern crate cookie;
Features
This crates can be configured at compile-time through the following Cargo features:
secure (enabled by default)
Enables signing and encryption of cookies.
When this feature is enabled, signed and encrypted cookies jars will encrypt and/or sign any cookies added to them. When this feature is disabled, those cookies will be added in plaintext.
percent-encode (disabled by default)
Enables percent encoding and decoding of names and values in cookies.
When this feature is enabled, the encoded and parse_encoded methods of
Cookiebecome available. Theencodedmethod returns a wrapper around aCookiewhoseDisplayimplementation percent-encodes the name and value of the cookie. Theparse_encodedmethod percent-decodes the name and value of aCookieduring parsing. When this feature is disabled, theencodedandparse_encodedmethods are not available.
You can enable features via the Cargo.toml file:
[dependencies.cookie] features = ["secure", "percent-encode"]
Structs
| Cookie |
Representation of an HTTP cookie. |
| CookieBuilder |
Structure that follows the builder pattern for building |
| CookieJar |
A jar of cookies for managing a session. |
| EncodedCookie |
Wrapper around |
Enums
| ParseError |
Enum corresponding to a parsing error. |