Move most of the configuration into ClientRequest

Also fixes in-place modification of the query string which resulted in
duplication of the GET parameters when calling #to_s more than once.