http://bugs.python.org/issue6267
Cumulative patch to http and xmlrpc
diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py
index 7a25d0f..73cd219 100644
--- a/Lib/SocketServer.py
+++ b/Lib/SocketServer.py
@@ -445,6 +445,7 @@
 
     def close_request(self, request):
         """Called to clean up an individual request."""
+        request.shutdown(socket.SHUT_WR)
         request.close()
 
 
@@ -610,12 +611,11 @@
         self.request = request
         self.client_address = client_address
         self.server = server
+        self.setup()
         try:
-            self.setup()
             self.handle()
-            self.finish()
         finally:
-            sys.exc_traceback = None    # Help garbage collection
+            self.finish()
 
     def setup(self):
         pass
@@ -649,12 +649,17 @@
     rbufsize = -1
     wbufsize = 0
 
+    # A timeout to apply to the request socket, if not None.
+    timeout = None
+
     # Disable nagle algoritm for this socket, if True.
     # Use only when wbufsize != 0, to avoid small packets.
     disable_nagle_algorithm = False
 
     def setup(self):
         self.connection = self.request
+        if self.timeout is not None:
+            self.connection.settimeout(self.timeout)
         if self.disable_nagle_algorithm:
             self.connection.setsockopt(socket.IPPROTO_TCP,
                                        socket.TCP_NODELAY, True)