Client: better management of the http connections