Improve header handling on redirects

I borrowed some code over from LWP::UserAgent.

This will make redirected requests retain their headers, like user-agent.

Also, it adds support for HTTP::Cookies style cookie jars.  That's needed for adding cookies to headers according to domain and path.