Move http_class selection out of the setup_http method
Move Location header parsing logic into its own method
Replace recursion with iteration
Only raise ImageFetchFailure inside the method responsible for fetching