Comparing version 11.0.4 to 11.0.5
@@ -326,3 +326,3 @@ "use strict"; | ||
*/ | ||
function execHttp1(req, protocol, host, port, keepAlive, socket) { | ||
function execHttp1(req, keepAlive, socket) { | ||
return new Promise((resolve, reject) => { | ||
@@ -333,5 +333,6 @@ const { url, body, Url } = req; | ||
const arg = { | ||
protocol, | ||
host, | ||
port, | ||
protocol: Url.protocol, | ||
host: Url.hostname, | ||
port: Url.port, | ||
defaultPort: encrypted ? 443 : 80, | ||
method: req.method, | ||
@@ -352,3 +353,3 @@ path: Url.path, | ||
function onError(err) { | ||
return reject(new error_1.PopsicleError(`Unable to connect to ${host}:${port}`, 'EUNAVAILABLE', req, err)); | ||
return reject(new error_1.PopsicleError(`Unable to connect to ${Url.host}`, 'EUNAVAILABLE', req, err)); | ||
} | ||
@@ -400,3 +401,3 @@ // Track the node.js response. | ||
*/ | ||
function execHttp2(req, protocol, host, port, client) { | ||
function execHttp2(req, client) { | ||
return new Promise((resolve, reject) => { | ||
@@ -418,3 +419,3 @@ // HTTP2 formatted headers. | ||
function onError(err) { | ||
return reject(new error_1.PopsicleError(`Unable to connect to ${host}:${port}`, 'EUNAVAILABLE', req, err)); | ||
return reject(new error_1.PopsicleError(`Unable to connect to ${req.Url.host}`, 'EUNAVAILABLE', req, err)); | ||
} | ||
@@ -474,3 +475,3 @@ function onResponse(headers) { | ||
if (existingSession) | ||
return execHttp2(req, protocol, host, port, existingSession); | ||
return execHttp2(req, existingSession); | ||
} | ||
@@ -486,5 +487,5 @@ return new Promise((resolve) => { | ||
const client = manageHttp2(authority, connectionKey, keepAlive, http2Connections, socket); | ||
return resolve(execHttp2(req, protocol, host, port, client)); | ||
return resolve(execHttp2(req, client)); | ||
} | ||
return resolve(execHttp1(req, protocol, host, port, keepAlive, socket)); | ||
return resolve(execHttp1(req, keepAlive, socket)); | ||
}); | ||
@@ -512,3 +513,3 @@ }); | ||
if (existingSession) | ||
return execHttp2(req, protocol, host, port, existingSession); | ||
return execHttp2(req, existingSession); | ||
} | ||
@@ -528,7 +529,7 @@ return new Promise((resolve, reject) => { | ||
if (negotiateHttpVersion === NegotiateHttpVersion.HTTP1_ONLY) { | ||
return resolve(execHttp1(req, protocol, host, port, keepAlive, socket)); | ||
return resolve(execHttp1(req, keepAlive, socket)); | ||
} | ||
if (negotiateHttpVersion === NegotiateHttpVersion.HTTP2_ONLY) { | ||
const client = manageHttp2(`${protocol}//${host}:${port}`, connectionKey, keepAlive, http2Connections, socket); | ||
return resolve(execHttp2(req, protocol, host, port, client)); | ||
return resolve(execHttp2(req, client)); | ||
} | ||
@@ -543,9 +544,9 @@ // Execute HTTP connection according to negotiated ALPN protocol. | ||
socket.destroy(); // Destroy socket in case of TLS connection race. | ||
return resolve(execHttp2(req, protocol, host, port, existingClient)); | ||
return resolve(execHttp2(req, existingClient)); | ||
} | ||
const client = manageHttp2(`${protocol}//${host}:${port}`, connectionKey, keepAlive, http2Connections, socket); | ||
return resolve(execHttp2(req, protocol, host, port, client)); | ||
return resolve(execHttp2(req, client)); | ||
} | ||
if (alpnProtocol === 'http/1.1' || alpnProtocol === false) { | ||
return resolve(execHttp1(req, protocol, host, port, keepAlive, socket)); | ||
return resolve(execHttp1(req, keepAlive, socket)); | ||
} | ||
@@ -552,0 +553,0 @@ return reject(new error_1.PopsicleError(`Unknown ALPN protocol negotiated: ${alpnProtocol}`, 'EALPNPROTOCOL', req)); |
{ | ||
"name": "popsicle", | ||
"version": "11.0.4", | ||
"version": "11.0.5", | ||
"description": "Advanced HTTP requests in node.js and browsers, using Servie", | ||
@@ -5,0 +5,0 @@ "main": "dist/universal.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1343
153531