Allow caller to pass cookieDomain for rewriting domain on cookies. Move initHttpRequest to HttpUtil