Permalink
Browse files

Merge branch 'master' of github.com:Stanley/request

  • Loading branch information...
2 parents 875f79b + 0d771ab commit 86895b9c37f7b412b7df963c2a75361ff402d8c5 @Stanley Stanley committed Jan 29, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 main.js
View
@@ -15,6 +15,7 @@
var http = require('http')
, url = require('url')
, sys = require('sys')
+ , qs = require('querystring')
;
var toBase64 = function(str) {
@@ -89,10 +90,10 @@ function request (options, callback) {
options.client.addListener('error', clientErrorHandler);
if (options.uri.auth && !options.headers.authorization) {
- options.headers.authorization = "Basic " + toBase64(options.uri.auth);
+ options.headers.authorization = "Basic " + toBase64(options.uri.auth.split(':').map(qs.unescape).join(':'));
}
if (options.proxy && options.proxy.auth && !options.headers['proxy-authorization']) {
- options.headers['proxy-authorization'] = "Basic " + toBase64(options.proxy.auth);
+ options.headers['proxy-authorization'] = "Basic " + toBase64(options.proxy.auth.split(':').map(qs.unescape).join(':'));
}
options.fullpath = options.uri.href.replace(options.uri.protocol + '//' + options.uri.host, '');

0 comments on commit 86895b9

Please sign in to comment.