def setup(self):
    self.connection = self.request
if self.timeout is not None:
    self.connection.settimeout(self.timeout)
if self.disable_nagle_algorithm:
    self.connection.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True)
self.rfile = self.connection.makefile('rb', self.rbufsize)
self.wfile = self.connection.makefile('wb', self.wbufsize)
SimpleHTTPRequestHandler close connection before returning from do_POST method