Created
April 21, 2010 23:57
-
-
Save santa4nt/374606 to your computer and use it in GitHub Desktop.
A patch for slow BaseHTTPServer's default handler.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a hack to patch slow socket.getfqdn calls that | |
# BaseHTTPServer (and its subclasses) make. | |
# See: http://bugs.python.org/issue6085 | |
# See: http://www.answermysearches.com/xmlrpc-server-slow-in-python-how-to-fix/2140/ | |
import BaseHTTPServer | |
def _bare_address_string(self): | |
host, port = self.client_address[:2] | |
return str(host) | |
BaseHTTPServer.BaseHTTPRequestHandler.address_string = \ | |
_bare_address_string | |
# End hack. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment