Skip to content

Commit

Permalink
Update to rust-url 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Mar 2, 2016
1 parent 3d257f8 commit 1b728a0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib.rs
Expand Up @@ -50,13 +50,11 @@ impl Cookie {
let mut pairs = s.trim().split(';');
let keyval = match pairs.next() { Some(s) => s, _ => return Err(()) };
let (name, value) = try!(split(keyval));
let name = url::percent_encoding::percent_decode(name.as_bytes());
if name.is_empty() {
c.name = try!(url::percent_encoding::utf8_percent_decode(name.as_bytes()).map_err(|_| ()));
if c.name.is_empty() {
return Err(());
}
let value = url::percent_encoding::percent_decode(value.as_bytes());
c.name = try!(String::from_utf8(name).map_err(|_| ()));
c.value = try!(String::from_utf8(value).map_err(|_| ()));
c.value = try!(url::percent_encoding::utf8_percent_decode(value.as_bytes()).map_err(|_| ()));

for attr in pairs {
let trimmed = attr.trim();
Expand Down

0 comments on commit 1b728a0

Please sign in to comment.