curl http code testing and better logging