mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[minor] Added missing JSDoc comments
This commit is contained in:
parent
3ab6e9591e
commit
73e8a4cdd5
@ -102,17 +102,36 @@ common.setupSocket = function(socket) {
|
||||
return socket;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the port number from the host. Or guess it based on the connection type.
|
||||
*
|
||||
* @param {Request} req Incoming HTTP request.
|
||||
*
|
||||
* @return {String} The port number.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
common.getPort = function(req) {
|
||||
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : "";
|
||||
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : '';
|
||||
|
||||
return res ?
|
||||
res[1] :
|
||||
req.connection.pair ? '443' : '80' ;
|
||||
req.connection.pair ? '443' : '80';
|
||||
};
|
||||
|
||||
// OS-agnostic join (doesn't break on URLs like path.join does on Windows)
|
||||
/**
|
||||
* OS-agnostic join (doesn't break on URLs like path.join does on Windows)>
|
||||
*
|
||||
* @return {String} The generated path.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
common.urlJoin = function() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
// Join all strings, but remove empty strings so we don't get extra slashes from
|
||||
// Join all strings, but remove empty strings so we don't get extra slashes from
|
||||
// joining e.g. ['', 'am']
|
||||
return args.filter(function(a) { return !!a; }).join('/').replace(/\/+/g, '/');
|
||||
return args.filter(function filter(a) {
|
||||
return !!a;
|
||||
}).join('/').replace(/\/+/g, '/');
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user