[Freeipa-devel] [PATCH 83] Cookie Expires date should be locale insensitive

Petr Viktorin pviktori at redhat.com
Thu Dec 20 11:35:45 UTC 2012


On 12/19/2012 07:36 PM, John Dennis wrote:
>
> The Expires attribute in a cookie is supposed to follow the RFC 822
> (superseded by RFC 1123) date format. That format includes a weekday
> abbreviation (e.g. Tue) which must be in English according to the
> RFC's.
>
> ipapython/cooke.py has methods to parse and format the Expires
> attribute but they were based on strptime() and strftime() which
> respects the locale. If a non-English locale is in effect the wrong
> date string will be produced and/or it won't be able to parse the date
> string.
>
> The fix is to use the date parsing and formatting functions from
> email.utils which specifically follow the RFC's and are not locale
> sensitive.
>
> This patch also updates the unit test to use email.utils as well.
>
> The patch should be applied to the following branches:
>
> master, 3.0, 3.1
>
> Ticket:https://fedorahosted.org/freeipa/ticket/3313

This solves the issue for me. It's better than what's there now, so It's 
OK as a hotfix. However, I did find something to discuss.


Your comment references RFC 1123, which doesn't seem relevant at all.
The cookie Expires header is defined in RFC 6265 (section 5.1.1), but 
email.utils.parsedate uses syntax defined in RFC 2822. Apparently the 
two are equivalent for common usage, but RFC 6265 specifies a more 
complicated algorithm. Shouldn't we follow it?



To nitpick, I'm not a fan of including target branches in the commit 
message (they should be in the accompanying e-mail), or of documenting 
past bugs as comments in the code (git log/blame works better for 
checking history).


-- 
Petr³




More information about the Freeipa-devel mailing list