diff Lib/http/client.py @ 52369:8d6918af232b

Fix compatibility issue with HTTPMessage class. The server needs to use MessageClass to parse.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Fri, 27 Mar 2009 18:31:36 +0000
parents ee4a006d0171
children 8b691690babd
line wrap: on
line diff
--- a/Lib/http/client.py	Fri Mar 27 17:16:06 2009 +0000
+++ b/Lib/http/client.py	Fri Mar 27 18:31:36 2009 +0000
@@ -213,7 +213,6 @@
         occurrences are returned.  Case is not important in the header name.
 
         """
-        # XXX: copied from rfc822.Message for compatibility
         name = name.lower() + ':'
         n = len(name)
         lst = []
@@ -227,7 +226,7 @@
                 lst.append(line)
         return lst
 
-def parse_headers(fp):
+def parse_headers(fp, _class=HTTPMessage):
     """Parses only RFC2822 headers from a file pointer.
 
     email Parser wants to see strings rather than bytes.
@@ -245,7 +244,7 @@
             break
     hstring = b''.join(headers).decode('iso-8859-1')
 
-    return email.parser.Parser(_class=HTTPMessage).parsestr(hstring)
+    return email.parser.Parser(_class=_class).parsestr(hstring)
 
 class HTTPResponse(io.RawIOBase):