summaryrefslogtreecommitdiff
path: root/lib/_http_client.js
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2017-04-24 02:19:30 -0400
committerBrian White <mscdex@mscdex.net>2017-04-30 03:17:29 -0400
commite283319969bc0940ed6baff2637608488ef0c195 (patch)
tree8c8a0e789e2a7b2e7f5435dc180c5abfc27b2659 /lib/_http_client.js
parent7a5bac5d36cabf4061ea6a4de2ee0f779d44f11c (diff)
downloadandroid-node-v8-e283319969bc0940ed6baff2637608488ef0c195.tar.gz
android-node-v8-e283319969bc0940ed6baff2637608488ef0c195.tar.bz2
android-node-v8-e283319969bc0940ed6baff2637608488ef0c195.zip
http: fix permanent deoptimizations
PR-URL: https://github.com/nodejs/node/pull/12456 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/_http_client.js')
-rw-r--r--lib/_http_client.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/_http_client.js b/lib/_http_client.js
index 42387d0930..e1f064e832 100644
--- a/lib/_http_client.js
+++ b/lib/_http_client.js
@@ -127,8 +127,8 @@ function ClientRequest(options, cb) {
'Expected "' + expectedProtocol + '"');
}
- const defaultPort = options.defaultPort ||
- this.agent && this.agent.defaultPort;
+ var defaultPort = options.defaultPort ||
+ this.agent && this.agent.defaultPort;
var port = options.port = options.port || defaultPort || 80;
var host = options.host = validateHost(options.hostname, 'hostname') ||
@@ -226,7 +226,7 @@ function ClientRequest(options, cb) {
var called = false;
- const oncreate = (err, socket) => {
+ var oncreate = (err, socket) => {
if (called)
return;
called = true;
@@ -238,14 +238,15 @@ function ClientRequest(options, cb) {
this._deferToConnect(null, null, () => this._flush());
};
+ var newSocket;
if (this.socketPath) {
this._last = true;
this.shouldKeepAlive = false;
- const optionsPath = {
+ var optionsPath = {
path: this.socketPath,
timeout: this.timeout
};
- const newSocket = this.agent.createConnection(optionsPath, oncreate);
+ newSocket = this.agent.createConnection(optionsPath, oncreate);
if (newSocket && !called) {
called = true;
this.onSocket(newSocket);
@@ -270,7 +271,7 @@ function ClientRequest(options, cb) {
this._last = true;
this.shouldKeepAlive = false;
if (typeof options.createConnection === 'function') {
- const newSocket = options.createConnection(options, oncreate);
+ newSocket = options.createConnection(options, oncreate);
if (newSocket && !called) {
called = true;
this.onSocket(newSocket);