Skip to content

Commit

Permalink
Use constructor name instead of referer to detect http/https protocol.
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoguchi committed Jun 22, 2011
1 parent 01004d4 commit fbef0e3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion lib/modules/box.js
Expand Up @@ -61,7 +61,6 @@ everyModule.submodule('box')
, api_key: this._apiKey
}
}).on('success', function (data, res) {
console.log(data);
var status = data.status
, ticket = data.ticket;
promise.fulfill(ticket);
Expand Down
1 change: 0 additions & 1 deletion lib/modules/linkedin.js
Expand Up @@ -38,7 +38,6 @@ oauthModule.submodule('linkedin')
this.oauth.get(this.apiHost() + '/people/~:(id,first-name,last-name,headline,location:(name,country:(code)),industry,num-connections,num-connections-capped,summary,specialties,proposal-comments,associations,honors,interests,positions,publications,patents,languages,skills,certifications,educations,three-current-positions,three-past-positions,num-recommenders,recommendations-received,phone-numbers,im-accounts,twitter-accounts,date-of-birth,main-address,member-url-resources,picture-url,site-standard-profile-request:(url),api-standard-profile-request:(url,headers),public-profile-url)', accessToken, accessTokenSecret, function (err, data) {
if (err) return promise.fail(err);
var oauthUser = JSON.parse(data);
console.log(oauthUser);
promise.fulfill(oauthUser);
});
return promise;
Expand Down
6 changes: 3 additions & 3 deletions lib/utils.js
Expand Up @@ -24,9 +24,9 @@ function cloneArray (arr) {

exports.extractHostname = function (req) {
var headers = req.headers
, protocol = headers.referer.substring(0, 5) === 'https'
? 'https://'
: 'http://'
, protocol = req.connection.server.constructor.name === 'HTTPServer'
? 'http://'
: 'https://' // === 'HTTPSServer'
, host = headers.host;
return protocol + host;
};

0 comments on commit fbef0e3

Please sign in to comment.