'Close the connection to the HTTP server.'

def close(self):

    self.__state = _CS_IDLE
    try:
        sock = self.sock
        if sock:
            self.sock = None
            sock.close()
    finally:
        response = self.__response
        if response:
            self.__response = None
            response.close()
