Cleanup sample http client

simplify and fix bugs - the string handling here is really bad