refactor out http module, add gateway returned headers to client, fix problem with handling posts without sending body content to gateway