Author akira
Recipients akira, christian.heimes, docs@python, gudge, janssen, pitrou
Date 2013-12-10.21:37:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1386711448.65.0.591865932318.issue19940@psf.upfronthosting.co.za>
In-reply-to
Content
gudge,

There is also an issue with the current strptime format [1] (`"%b %d %H:%M:%S %Y GMT"`). It is locale-dependent and it may fail if a non-English locale is in effect. I don't know whether I should open a new issue on this or are you going to fix it too.

`cert_time_to_seconds()` is documented [2] to parse notBefore, notAfter fields from a certificate. As far as I can tell they do not depend on current locale. Thus the following code should not fail:

    >>> timestr = "May  9 00:00:00 2007 GMT"
    >>> import ssl
    >>> ssl.cert_time_to_seconds(timestr)
    1178661600.0
    >>> import locale
    >>> locale.setlocale(locale.LC_TIME, 'pl_PL.utf8')
    'pl_PL.utf8'
    >>> ssl.cert_time_to_seconds(timestr)
    Traceback (most recent call last):
    ...[snip]...
    ValueError: time data 'May  9 00:00:00 2007 GMT' does not match format '%b %d %H:%M:%S %Y GMT'


[1]: http://hg.python.org/cpython/file/96a68e369d13/Lib/ssl.py#l849
[2]: http://hg.python.org/cpython/file/96a68e369d13/Doc/library/ssl.rst#l359
History
Date User Action Args
2013-12-10 21:37:28akirasetrecipients: + akira, janssen, pitrou, christian.heimes, docs@python, gudge
2013-12-10 21:37:28akirasetmessageid: <1386711448.65.0.591865932318.issue19940@psf.upfronthosting.co.za>
2013-12-10 21:37:28akiralinkissue19940 messages
2013-12-10 21:37:28akiracreate