Skip to content

Commit 2df0f71

Browse files
committed
https-proxy-agent: initial Basic "Proxy-Authorization" support
1 parent 319000f commit 2df0f71

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

https-proxy-agent.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ HttpsProxyAgent.prototype.createConnection = function (opts, fn) {
102102
}
103103

104104
var hostname = opts.host + ':' + opts.port;
105-
var msg = 'CONNECT ' + hostname + ' HTTP/1.1\r\n' +
106-
'Host: ' + hostname + '\r\n' +
105+
var msg = 'CONNECT ' + hostname + ' HTTP/1.1\r\n';
106+
var auth = this.proxy.auth;
107+
if (auth) {
108+
msg += 'Proxy-Authorization: Basic ' + new Buffer(auth).toString('base64') + '\r\n';
109+
}
110+
msg += 'Host: ' + hostname + '\r\n' +
107111
'\r\n';
108112
socket.write(msg);
109113
};

0 commit comments

Comments
 (0)