Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mikeal/request
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeal committed Sep 17, 2011
2 parents d8c53fc + eaf073f commit 731b32b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Request.prototype.request = function () {

var clientErrorHandler = function (error) {
if (setHost) delete self.headers.host
if (self.timeout && self.timeoutTimer) clearTimeout(self.timeoutTimer)
self.emit('error', error)
}
if (self.onResponse) self.on('error', function (e) {self.onResponse(e)})
Expand All @@ -158,7 +159,7 @@ Request.prototype.request = function () {
self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
}
if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization']) {
self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
}

self.path = self.uri.href.replace(self.uri.protocol + '//' + self.uri.host, '')
Expand Down Expand Up @@ -231,7 +232,9 @@ Request.prototype.request = function () {
self.response = response
response.request = self

if (self.strictSSL && !response.client.authorized) {
if (self.httpModule === https &&
self.strictSSL &&
!response.client.authorized) {
var sslErr = response.client.authorizationError
self.emit('error', new Error('SSL Error: '+ sslErr))
return
Expand Down Expand Up @@ -432,7 +435,7 @@ request.defaults = function (options) {
}
return d
}
de = def(request)
var de = def(request)
de.get = def(request.get)
de.post = def(request.post)
de.put = def(request.put)
Expand Down

0 comments on commit 731b32b

Please sign in to comment.