Fix handling http errors when retrying with url encoding disabled