Skip to content

Commit

Permalink
Workaround for GitHub issue request#2807 (request#2808)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgonzal authored and reconbot committed Dec 1, 2018
1 parent 167065e commit 2bc3cc4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions request.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,16 @@ Request.prototype.onRequestError = function (error) {
clearTimeout(self.timeoutTimer)
self.timeoutTimer = null
}

// This is a workaround for a race condition caused by the way that lib/redirect.js
// calls Request.init() when processing an HTTP redirect:
// https://github.com/request/request/issues/2807
// Somehow we end up with an ECONNRESET error from a socket that has already
// been destroyed and returned to the pool.
if (self.req && self.req.socket && self.req.socket.destroyed) {
return
}

self.emit('error', error)
}

Expand Down

0 comments on commit 2bc3cc4

Please sign in to comment.