Fix Location header handling on redirects.
Fix connection close handling to handle the differences between client and server.