This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients ajaksu2, eric.araujo, l0nwlf, r.david.murray, schmiddy
Date 2010-04-12.13:31:08
SpamBayes Score 9.657247e-11
Marked as misclassified No
Message-id <>
There are a couple problems with this patch.  The first is that fixing date_time_string by using strftime rather than email.utils.formatdate is suboptimal from a code reuse standpoint.  The reason is that the date in HTTP message headers is required to conform to the same RFC standard as that generated by formatdate, so it is better to use the same routine to generate it.  That way any bug fixes needed to handle RFC compliance are centralized in once place.

The second problem with the patch is that strftime generates locale-aware week and month names, but per RFC the header timestamps must use English names (see for example msg53731 in issue 665194; the comment about locale applies to both strftime and strptime).

If issue 665194 were implemented formatdate could use it, and then BaseHTTPServer could also use it directly.  But absent that it should use email.util.formatdate.  (That issue should also answer Éric's question about whether we can use DateTime here: not yet.)

Now, the logging routine is a different story.  That timestamp isn't required to follow the RFC, and one could argue that it makes sense for its timestamp to use the locale.  (One could also ask whether BaseHTTPServer should use the logging module, but that is a whole separate issue.)

We definitely should have a unit test before applying this patch, that makes sure the timestamp gets generated without error.  Checking the detailed format of the timestamp can be assumed to be covered by the unit tests for formatdate.  (I don't think those tests are completely adequate; for example they don't test that the date remains in English if the locale is different, but again that is a different issue.)
Date User Action Args
2010-04-12 13:31:11r.david.murraysetrecipients: + r.david.murray, ajaksu2, eric.araujo, schmiddy, l0nwlf
2010-04-12 13:31:11r.david.murraysetmessageid: <>
2010-04-12 13:31:09r.david.murraylinkissue7370 messages
2010-04-12 13:31:08r.david.murraycreate