HttpApiClient and some refinement for Curl
Refactored a bit, cleaned up code, see notes on previous commit
fixed bugs with setAuth, other cruft cleanup