Skip to content

Commit

Permalink
Suppress error that occur before _httpMessage has been set
Browse files Browse the repository at this point in the history
Temporary fix for request#1903
  • Loading branch information
eugirdor committed Jan 28, 2016
1 parent c54be10 commit b92e0e0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions request.js
Expand Up @@ -79,7 +79,13 @@ function connectionErrorHandler(error) {
socket.res.emit('error', error)
}
} else {
socket._httpMessage.emit('error', error)
if (socket._httpMessage) {
socket._httpMessage.emit('error', error)
} else {
if (socket.listenerCount('error') > 0) {
socket.emit('error', error)
}
}
}
}

Expand Down Expand Up @@ -1229,10 +1235,10 @@ Request.prototype.aws = function (opts, now) {
self._aws = opts
return self
}

if (opts.sign_version == 4 || opts.sign_version == '4') {
var aws4 = require('aws4')
// use aws4
// use aws4
var options = {
host: self.uri.host,
path: self.uri.path,
Expand Down

0 comments on commit b92e0e0

Please sign in to comment.