Skip to content

Commit 7546030

Browse files
author
Don McCurdy
committed
Include brackets for IPv6 host header.
1 parent 08577de commit 7546030

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/XMLHttpRequest.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ exports.XMLHttpRequest = function() {
111111
this.responseXML = "";
112112
this.status = null;
113113
this.statusText = null;
114-
114+
115115
// Whether cross-site Access-Control requests should be made using
116116
// credentials such as cookies or authorization headers
117117
this.withCredentials = false;
@@ -344,6 +344,9 @@ exports.XMLHttpRequest = function() {
344344
// Set the Host header or the server may reject the request
345345
headers.Host = host;
346346
if (!((ssl && port === 443) || port === 80)) {
347+
if (url.host[0] === '[') {
348+
headers.Host = '[' + headers.Host + ']';
349+
}
347350
headers.Host += ":" + url.port;
348351
}
349352

0 commit comments

Comments
 (0)