Skip to content

Commit 072d4fe

Browse files
committed
Merge pull request #687 from hyperium/ssl-and-cookie-up
chore(dependencies): update openssl to 0.7 and cookie to 0.2
2 parents d44ee59 + 799698c commit 072d4fe

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ unicase = "1.0"
2525
url = "0.2"
2626

2727
[dependencies.cookie]
28-
version = "0.1"
28+
version = "0.2"
2929
default-features = false
3030

3131
[dependencies.openssl]
32-
version = "0.6.4"
32+
version = "0.7"
3333
optional = true
3434

3535
[dependencies.solicit]

src/header/common/cookie.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
use header::{Header, HeaderFormat};
1+
use header::{Header, HeaderFormat, CookiePair, CookieJar};
22
use std::fmt::{self, Display};
33
use std::str::from_utf8;
44

5-
use cookie::Cookie as CookiePair;
6-
use cookie::CookieJar;
7-
85
/// `Cookie` header, defined in [RFC6265](http://tools.ietf.org/html/rfc6265#section-5.4)
96
///
107
/// If the user agent does attach a Cookie header field to an HTTP

src/header/common/set_cookie.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
use header::{Header, HeaderFormat};
1+
use header::{Header, HeaderFormat, CookiePair, CookieJar};
22
use std::fmt::{self, Display};
33
use std::str::from_utf8;
44

5-
use cookie::Cookie;
6-
use cookie::CookieJar;
75

86
/// `Set-Cookie` header, defined [RFC6265](http://tools.ietf.org/html/rfc6265#section-4.1)
97
///
@@ -80,9 +78,9 @@ use cookie::CookieJar;
8078
/// # }
8179
/// ```
8280
#[derive(Clone, PartialEq, Debug)]
83-
pub struct SetCookie(pub Vec<Cookie>);
81+
pub struct SetCookie(pub Vec<CookiePair>);
8482

85-
__hyper__deref!(SetCookie => Vec<Cookie>);
83+
__hyper__deref!(SetCookie => Vec<CookiePair>);
8684

8785
impl Header for SetCookie {
8886
fn header_name() -> &'static str {
@@ -142,7 +140,7 @@ impl SetCookie {
142140
#[test]
143141
fn test_parse() {
144142
let h = Header::parse_header(&[b"foo=bar; HttpOnly".to_vec()][..]);
145-
let mut c1 = Cookie::new("foo".to_owned(), "bar".to_owned());
143+
let mut c1 = CookiePair::new("foo".to_owned(), "bar".to_owned());
146144
c1.httponly = true;
147145

148146
assert_eq!(h.ok(), Some(SetCookie(vec![c1])));
@@ -152,22 +150,22 @@ fn test_parse() {
152150
fn test_fmt() {
153151
use header::Headers;
154152

155-
let mut cookie = Cookie::new("foo".to_owned(), "bar".to_owned());
153+
let mut cookie = CookiePair::new("foo".to_owned(), "bar".to_owned());
156154
cookie.httponly = true;
157155
cookie.path = Some("/p".to_owned());
158-
let cookies = SetCookie(vec![cookie, Cookie::new("baz".to_owned(), "quux".to_owned())]);
156+
let cookies = SetCookie(vec![cookie, CookiePair::new("baz".to_owned(), "quux".to_owned())]);
159157
let mut headers = Headers::new();
160158
headers.set(cookies);
161159

162160
assert_eq!(
163161
&headers.to_string()[..],
164-
"Set-Cookie: foo=bar; HttpOnly; Path=/p\r\nSet-Cookie: baz=quux; Path=/\r\n");
162+
"Set-Cookie: foo=bar; HttpOnly; Path=/p\r\nSet-Cookie: baz=quux\r\n");
165163
}
166164

167165
#[test]
168166
fn cookie_jar() {
169167
let jar = CookieJar::new(b"secret");
170-
let cookie = Cookie::new("foo".to_owned(), "bar".to_owned());
168+
let cookie = CookiePair::new("foo".to_owned(), "bar".to_owned());
171169
jar.add(cookie);
172170

173171
let cookies = SetCookie::from_cookie_jar(&jar);
@@ -176,5 +174,5 @@ fn cookie_jar() {
176174
cookies.apply_to_cookie_jar(&mut new_jar);
177175

178176
assert_eq!(jar.find("foo"), new_jar.find("foo"));
179-
assert_eq!(jar.iter().collect::<Vec<Cookie>>(), new_jar.iter().collect::<Vec<Cookie>>());
177+
assert_eq!(jar.iter().collect::<Vec<CookiePair>>(), new_jar.iter().collect::<Vec<CookiePair>>());
180178
}

src/header/shared/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
pub use self::charset::Charset;
2+
pub use cookie::Cookie as CookiePair;
3+
pub use cookie::CookieJar;
24
pub use self::encoding::Encoding;
35
pub use self::entity::EntityTag;
46
pub use self::httpdate::HttpDate;

src/http/h2.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ mod tests {
661661
let h2headers = prepare_headers(headers);
662662

663663
assert_eq!(vec![
664-
(b"set-cookie".to_vec(), b"foo=bar; Path=/".to_vec()),
665-
(b"set-cookie".to_vec(), b"baz=quux; Path=/".to_vec()),
664+
(b"set-cookie".to_vec(), b"foo=bar".to_vec()),
665+
(b"set-cookie".to_vec(), b"baz=quux".to_vec()),
666666
], h2headers);
667667
}
668668

@@ -700,8 +700,8 @@ mod tests {
700700
#[test]
701701
fn test_http2_parse_headers_with_set_cookie() {
702702
let h2headers = vec![
703-
(b"set-cookie".to_vec(), b"foo=bar; Path=/".to_vec()),
704-
(b"set-cookie".to_vec(), b"baz=quux; Path=/".to_vec()),
703+
(b"set-cookie".to_vec(), b"foo=bar".to_vec()),
704+
(b"set-cookie".to_vec(), b"baz=quux".to_vec()),
705705
];
706706
let expected = header::SetCookie(vec![
707707
cookie::Cookie::new("foo".to_owned(), "bar".to_owned()),

0 commit comments

Comments
 (0)