visionmedia/superagent — pull request #169 by lbdremy (2013-01-13 15:53:25+00:00)
Title: Remove the host header when cleaning headers to properly follow the redirection.

Hello @visionmedia,

The redirection is not followed correctly when the address given by the `location` header contained a new host compared to the previous request.

For example this code fails to fetch the google main page:

```js
var redirections = [];
request
.get('http://google.com')
.on('redirect',function(res){
redirections.push(res.headers.location);
})
.redirects(10)
.end(function(err,res){
console.log(res.status); // 301
console.log(redirections);
// always the same url -> http://www.google.com/ because it requests only this page http://google.com
});
```

The problem is fixed by removing the `host` header in the `cleanHeader` method in `utils`.
This old `host` header overrides the new one there https://github.com/visionmedia/superagent/blob/master/lib/node/index.js#L477.