]> granicus.if.org Git - python/commitdiff
SF patch #747364: BaseHTTPServer doesn't need StringIO intermediary
authorRaymond Hettinger <python@rcn.com>
Sat, 9 Aug 2003 05:01:41 +0000 (05:01 +0000)
committerRaymond Hettinger <python@rcn.com>
Sat, 9 Aug 2003 05:01:41 +0000 (05:01 +0000)
(Contributed by Andrew Dalke.)

Lib/BaseHTTPServer.py

index edb15ab4306e38a0f418114677e1fbf904d07f0c..15e7525e0bd9fdb08d32ff9ab1629dd6ecd16ef3 100644 (file)
@@ -75,7 +75,6 @@ import time
 import socket # For gethostbyaddr()
 import mimetools
 import SocketServer
-import cStringIO
 
 # Default error message
 DEFAULT_ERROR_MESSAGE = """\
@@ -276,17 +275,8 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
             return False
         self.command, self.path, self.request_version = command, path, version
 
-        # Deal with pipelining
-        bytes = ""
-        while 1:
-            line = self.rfile.readline()
-            bytes = bytes + line
-            if line == '\r\n' or line == '\n' or line == '':
-                break
-
         # Examine the headers and look for a Connection directive
-        hfile = cStringIO.StringIO(bytes)
-        self.headers = self.MessageClass(hfile)
+        self.headers = self.MessageClass(self.rfile, 0)
 
         conntype = self.headers.get('Connection', "")
         if conntype.lower() == 'close':