diff --git a/lib/StringClient.js b/lib/StringClient.js index 70e2a40..5d438c2 100644 --- a/lib/StringClient.js +++ b/lib/StringClient.js @@ -119,7 +119,11 @@ StringClient.prototype.read = function read(options, callback) { req.once('result', self._onResult(callback)); req.once('redirect', function (res) { res.resume(); - options.path = res.headers.location; + var redirectURL = new URL(res.headers.location); + options.protocol = redirectURL.protocol; + options.hostname = redirectURL.hostname; + options.port = redirectURL.port; + options.path = redirectURL.href; if (res.forceGet) { forceGetOptions(options);