Skip to content

Commit

Permalink
fix(headers): Fix overflow with empty cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
fuchsnj committed Mar 16, 2015
1 parent 932baac commit 99baaa1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/header/common/cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ impl Header for Cookie {
impl HeaderFormat for Cookie {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let cookies = &self.0;
let last = cookies.len() - 1;
for (i, cookie) in cookies.iter().enumerate() {
try!(write!(fmt, "{}", cookie.pair()));
if i < last {
if i != 0 {
try!(fmt.write_str("; "));
}
try!(write!(fmt, "{}", cookie.pair()));
}
Ok(())
}
Expand Down

0 comments on commit 99baaa1

Please sign in to comment.