Spyce generates invalid HTTP dates? w/patch

Philip Semanchuk <[email protected]> Mon, 16 Apr 2007 21:31:08 -0400
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
Hi all,
I have noticed that Spyce generates HTTP headers with dates in local 
time. This is a no-no according to HTTP 1.1 ("All HTTP date/time stamps 
MUST be represented in Greenwich Mean Time (GMT), without exception." - 
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3) You can 
demonstrate the problem using this minimal Spyce file and Firefox's 
HTTP Live Headers extension:

[[response.expires()]]
<html>
<head><title>test</title></head>
<body>test</body>
</html>


The problem is in the function _genTimestampString() in response.py; 
the fix is a one-line patch:

131c131
<     thetime = time.strftime('%a, %d %b %Y %H:%M:%S %Z', 
time.localtime(thetime))
---
 >     thetime = time.strftime('%a, %d %b %Y %H:%M:%S GMT', 
time.gmtime(thetime))


bye
Philip


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/