Skip to content

Conversation

gottreu
Copy link

@gottreu gottreu commented Aug 24, 2014

The behavior of HTTP::Cookies::Netscape is different than HTTP::Cookies'
when saving and loading cookies that lack an explicit expiration.

HTTP::Cookies::Netscape now mimics curl's behavior by using 0 (as opposed to an empty string) to indicate an unset expiration date.

The behavior of HTTP::Cookies::Netscape is different than HTTP::Cookies'
when saving and loading cookies that lack an explicit expiration.
@isync
Copy link

isync commented Sep 25, 2015

I was running into this very same issue today: my cookies just didn't end up in the file written by HTTP::Cookies::Netscape::save(), and thought I was doing something wrong, only to discover that $now would always be > $expires as it ($expires) gets set to 0 in the line above when $expires is undef. Cookies without explicit expiration date are common, and the current code makes the save() routine skip these.

return if $discard && !$self->{ignore_discard};
$expires = $expires ? $expires - $HTTP::Cookies::EPOCH_OFFSET : 0;
return if $now > $expires;
$secure = $secure ? "TRUE" : "FALSE";

Gisle, please merge or fix on next release.

@oalders
Copy link
Member

oalders commented Oct 12, 2016

Is it possible to get a test for this?

@isync
Copy link

isync commented Oct 12, 2016

Sorry, Olaf, can't elaborate on my earlier comment easily. I grep'ed through my repos to see where I had the issue but couldn't find it anymore (to fabricate a proper test).
From squinting at the pull-request: it seems to fix the issue: It allows the return (which was the cause for the skipping) only for cases where $expires is TRUE - and carries over a 0 when undef or 0.

@oalders
Copy link
Member

oalders commented Oct 12, 2016

@isync thanks for looking into this. We're trying to merge the easy stuff first. I'll put this on hold until we have a test for it, I think.

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

Successfully merging this pull request may close these issues.

3 participants