We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7546030 commit 60def8dCopy full SHA for 60def8d
lib/XMLHttpRequest.js
@@ -343,10 +343,11 @@ exports.XMLHttpRequest = function() {
343
344
// Set the Host header or the server may reject the request
345
headers.Host = host;
346
+ // IPv6 addresses must be escaped with brackets
347
+ if (url.host[0] === "[") {
348
+ headers.Host = "[" + headers.Host + "]";
349
+ }
350
if (!((ssl && port === 443) || port === 80)) {
- if (url.host[0] === '[') {
- headers.Host = '[' + headers.Host + ']';
- }
351
headers.Host += ":" + url.port;
352
}
353
0 commit comments