Skip to content

Instantly share code, notes, and snippets.

@iOS0x00
Forked from santa4nt/patch_basehttpserver.py
Created February 25, 2014 07:31
Show Gist options
  • Save iOS0x00/9204488 to your computer and use it in GitHub Desktop.
Save iOS0x00/9204488 to your computer and use it in GitHub Desktop.
# 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