http-client restructuring