fix bottle.py / wsgiref.simple_server slow

Running bottlepy with default server (wsgiref.simple_server) is always dog slow for me, after some digging I found that the fucking server is trying to resolve the IP address of 10.x.x.x, both the server and client, into hostnames so the fucking logger can 'properly' display them. FUCK THIS BULLSHIT.

Find BaseHTTPServer.py

Go to line 478;

def address_string(self):
    return self.client_address[0]

It works best if you have virtualenv set you can just modify a copy in the lib only for development use.

Fuck who ever wrote BaseHTTPRequestHandler.address_string() FUCK YOU ASSHOLE. Who ever thought reverse DNS lookup is acceptable is pure piece of shit. It only spams your log with fake & gay spammer domains.

Bottle.py is great Web framework, it supports Async WSGI calls, which Flask can not do. . It works even without using gevent as server. I am thinking of adding some sessions support to it. db backend maybe?

Update: for python 2.6, just write this line for monkey patch before bottle.run() or wsgiref.simple_server

__import__('BaseHTTPServer').BaseHTTPRequestHandler.address_string = lambda x:x.client_address[0]

Comments