Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -982,11 +982,21 @@ Agent.prototype.request = function request(options, callback) {
request.on('response', callback);
}

var key = [
!!options.plain,
options.host,
options.port
].join(':');
// Re-use transportUrl endPoint if specified
if (options.transportUrl && options.transport) {
key = ([
options.transportUrl
]).join(':');

// Re-use host:port endPoint
} else {
key = ([
!!options.plain,
options.host,
options.port
]).join(':');
}

var self = this;

// * There's an existing HTTP/2 connection to this host
Expand All @@ -996,9 +1006,9 @@ Agent.prototype.request = function request(options, callback) {
}

// * HTTP/2 over generic stream transport
else if(options.createConnection) {
else if(options.transport) {
endpoint = new Endpoint(this._log, 'CLIENT', this._settings);
endpoint.socket = options.createConnection(options);
endpoint.socket = options.transport;

endpoint.socket.on('error', function (error) {
self._log.error('Socket error: ' + error.toString());
Expand Down