[Medusa-dev] Handling of HTTP reply headers and ctime() dates

Joerg Sonnenberger joerg at britannica.bec.de
Sat Nov 15 10:19:32 EST 2003


And here's the actual patch ;-)
-------------- next part --------------
diff -uNr medusa-0.5.4.orig/http_date.py medusa-0.5.4/http_date.py
--- medusa-0.5.4.orig/http_date.py	Tue Mar 19 23:49:34 2002
+++ medusa-0.5.4/http_date.py	Fri Nov 14 17:25:44 2003
@@ -118,7 +118,10 @@
         if m and m.end() == len(d):
             retval = int (time.mktime (unpack_rfc822(m)) - tz)
         else:
-            return 0
+	    try:
+		return int( time.mktime ( time.strptime(d) ) )
+	    except:
+        	return 0
     # Thanks to Craig Silverstein <csilvers at google.com> for pointing
     # out the DST discrepancy
     if time.daylight and time.localtime(retval)[-1] == 1: # DST correction
diff -uNr medusa-0.5.4.orig/http_server.py medusa-0.5.4/http_server.py
--- medusa-0.5.4.orig/http_server.py	Fri Jul  4 02:24:02 2003
+++ medusa-0.5.4/http_server.py	Tue Oct 28 23:52:36 2003
@@ -73,13 +73,13 @@
     # reply header management
     # --------------------------------------------------
     def __setitem__ (self, key, value):
-        self.reply_headers[key] = value
+        self.reply_headers[key.lower()] = value
 
     def __getitem__ (self, key):
-        return self.reply_headers[key]
+        return self.reply_headers[key.lower()]
 
     def has_key (self, key):
-        return self.reply_headers.has_key (key)
+        return self.reply_headers.has_key (key.lower())
 
     def build_reply_header (self):
         return string.join (


More information about the Medusa-dev mailing list