http exception in stringToDateTime
Hello everyone, My webserver sent me this exception by email a few hours ago: exceptions.ValueError: Unknown datetime format 'Mon, 14 Mar 2005 02:11:29 GMT; length=10208' 2005/04/26 13:52 CEST [HTTPChannel,388,hidden] Traceback (most recent call last): File "/home/build/bin/i686/python-20050408/lib/python2.4/site-packages/twisted/internet/defer.py", line 216, in addCa llback File "/home/build/bin/i686/python-20050408/lib/python2.4/site-packages/twisted/internet/defer.py", line 207, in addCa llbacks File "/home/build/bin/i686/python-20050408/lib/python2.4/site-packages/twisted/internet/defer.py", line 328, in _runC allbacks File "/home/build/bin/i686/python-20050408/lib/python2.4/site-packages/nevow/appserver.py", line 158, in gotPageConte xt --- <exception caught here> --- File "/home/build/bin/i686/python-20050408/lib/python2.4/site-packages/twisted/internet/defer.py", line 117, in maybe Deferred File "/home/build/bin/i686/python-20050408/lib/python2.4/site-packages/nevow/static.py", line 293, in renderHTTP File "/home/build/bin/i686/python-20050408/lib/python2.4/site-packages/twisted/web/http.py", line 798, in setLastModi fied File "/home/build/bin/i686/python-20050408/lib/python2.4/site-packages/twisted/web/http.py", line 293, in stringToDat etime exceptions.ValueError: Unknown datetime format 'Mon, 14 Mar 2005 02:11:29 GMT; length=10208' It seems it has been generated by the https://www.cpushare.com/contact/ form my in website. These are the related https logs (all IP client addess hidden for full privacy of the user): [26/Apr/2005:11:51:33 +0000] "GET /contact/ HTTP/1.0" 302 340 "http://www.cpushare.com/legal" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:51:34 +0000] "GET /__session_key__cdc402734e5547886f2014b7138309ad/contact/ HTTP/1.0" 302 244 "http://www.cpushare.com/legal" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:51:34 +0000] "GET /contact/ HTTP/1.0" 200 5495 "http://www.cpushare.com/legal" "Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:51:35 +0000] "GET /cpushare.css HTTP/1.0" 200 10208 "https://www.cpushare.com/contact/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:51:35 +0000] "GET /contact/image_verification?cdc402734e5547886f2014b7138309ad_0_182154136 HTTP/1.0" 200 7033 "https://www.cpushare.com/contact/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:52:01 +0000] "GET /contact/ HTTP/1.0" 200 5495 "http://www.cpushare.com/about" "Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:52:02 +0000] "GET /contact/image_verification?cdc402734e5547886f2014b7138309ad_0_128972277 HTTP/1.0" 200 6957 "https://www.cpushare.com/contact/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:52:07 +0000] "GET /contact/ HTTP/1.0" 200 5495 "http://www.cpushare.com/about" "Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:52:08 +0000] "GET /cpushare.css HTTP/1.0" 302 - "https://www.cpushare.com/contact/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:52:08 +0000] "GET /contact/image_verification?cdc402734e5547886f2014b7138309ad_0_185839024 HTTP/1.0" 200 7046 "https://www.cpushare.com/contact/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" [26/Apr/2005:11:52:08 +0000] "GET /internal_server_error HTTP/1.0" 200 2099 "https://www.cpushare.com/contact/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" It sounds a minor bug in twisted/web not in my app. I won't have time to debug this myself until tomorrow, it's not very urgent since this is the first time it happened, and no other user reproduced this problem. Thanks.
On Apr 26, 2005, at 12:05 PM, Andrea Arcangeli wrote:
It sounds a minor bug in twisted/web not in my app. I won't have time to debug this myself until tomorrow, it's not very urgent since this is the first time it happened, and no other user reproduced this problem.
It is a "feature" of old versions of netscape, as well as current versions of MSIE when configured to use a HTTP 1.0 proxy (I think). MSIE is totally RFC-violating, but what can you do. It was fixed in t.web by r13529, which is a 1-line patch: Modified: trunk/twisted/web/http.py ======================================================================== ====== --- trunk/twisted/web/http.py (original) +++ trunk/twisted/web/http.py Tue Apr 12 10:20:40 2005 @@ -796,7 +796,7 @@ modified_since = self.getHeader('if-modified-since') if modified_since: - modified_since = stringToDatetime(modified_since) + modified_since = stringToDatetime(modified_since.split(';', 1)[0]) if modified_since >= when: self.setResponseCode(NOT_MODIFIED) return CACHED James
participants (2)
-
Andrea Arcangeli
-
James Y Knight