Skip to content

Instantly share code, notes, and snippets.

@santa4nt
Created April 21, 2010 23:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save santa4nt/374606 to your computer and use it in GitHub Desktop.
Save santa4nt/374606 to your computer and use it in GitHub Desktop.
A patch for slow BaseHTTPServer's default handler.
# 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