A fix for #1979 repeat HTTP digest authentication after redirect.
Clean up, support all redirects, fix potential endless 401 loop.
Clean up handle_redirect.
Merge pull request #2253 from yossigo/digest_redirect_fix

A fix for #1979: repeat HTTP digest authentication after redirect.