[issue6085] Logging in BaseHTTPServer.BaseHTTPRequestHandler causes lag

Santoso Wijaya report at bugs.python.org
Thu Apr 22 02:03:59 CEST 2010


Santoso Wijaya <santoso.wijaya at gmail.com> added the comment:

There is a simple workaround to bypass the hostname resolution mechanism, so that the server can respond faster.

# 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 '%s' % host

BaseHTTPServer.BaseHTTPRequestHandler.address_string = \
        _bare_address_string

# End hack.

----------
nosy: +Santoso.Wijaya

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6085>
_______________________________________


More information about the Python-bugs-list mailing list