Skip to content

Commit 0aeaba7

Browse files
committed
[fix] remove trailing whitespaces
1 parent 94ec6fa commit 0aeaba7

File tree

5 files changed

+45
-45
lines changed

5 files changed

+45
-45
lines changed

lib/caronte.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ var http = require('http'),
77

88
/**
99
* Creates the proxy server.
10-
*
10+
*
1111
* Examples:
12-
*
12+
*
1313
* caronte.createProxyServer({ .. }, 8000)
1414
* // => '{ web: [Function], ws: [Function] ... }'
1515
*
16-
* @param {Object} Options Config object passed to the proxy
16+
* @param {Object} Options Config object passed to the proxy
1717
*
18-
* @return {Object} Proxy Proxy object with handlers for `ws` and `web` requests
18+
* @return {Object} Proxy Proxy object with handlers for `ws` and `web` requests
1919
*
2020
* @api public
2121
*/
@@ -40,7 +40,7 @@ proxy.createProxyServer = function createProxyServer(options) {
4040
].join("\n"));
4141
}
4242

43-
options.ee = new events.EventEmitter2({ wildcard: true, delimiter: ':' });
43+
options.ee = new events.EventEmitter2({ wildcard: true, delimiter: ':' });
4444

4545
return {
4646
ee : options.ee,

lib/caronte/common.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ var common = exports,
22
extend = require('util')._extend;
33

44
/**
5-
* Copies the right headers from `options` and `req` to
6-
* `outgoing` which is then used to fire the proxied
5+
* Copies the right headers from `options` and `req` to
6+
* `outgoing` which is then used to fire the proxied
77
* request.
88
*
99
* Examples:
@@ -22,9 +22,9 @@ var common = exports,
2222
*/
2323

2424
common.setupOutgoing = function(outgoing, options, req, forward) {
25-
outgoing.port = options[forward || 'target'].port ||
25+
outgoing.port = options[forward || 'target'].port ||
2626
(~['https:', 'wss:'].indexOf(options[forward || 'target'].protocol) ? 443 : 80);
27-
27+
2828
['host', 'hostname', 'socketPath'].forEach(
2929
function(e) { outgoing[e] = options[forward || 'target'][e]; }
3030
);
@@ -36,7 +36,7 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
3636
if (options.headers){
3737
extend(outgoing.headers, options.headers);
3838
}
39-
39+
4040
outgoing.agent = options.agent || false;
4141
outgoing.path = req.url;
4242

lib/caronte/index.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ caronte.createWebProxy = createRightProxy('web');
88
caronte.createWsProxy = createRightProxy('ws');
99

1010
/**
11-
* Returns a function that creates the loader for
11+
* Returns a function that creates the loader for
1212
* either `ws` or `web`'s passes.
1313
*
1414
* Examples:
@@ -26,7 +26,7 @@ caronte.createWsProxy = createRightProxy('ws');
2626
function createRightProxy(type) {
2727
var passes = (type === 'ws') ? ws : web;
2828

29-
return function(options) {
29+
return function(options) {
3030

3131
passes = Object.keys(passes).map(function(pass) {
3232
return passes[pass];
@@ -42,25 +42,25 @@ function createRightProxy(type) {
4242
if(
4343
!(args[cntr] instanceof Buffer) &&
4444
args[cntr] !== res
45-
) {
45+
) {
4646
//Copy global options
4747
options = extend({}, options);
4848
//Overwrite with request options
4949
extend(options, args[cntr]);
50-
50+
5151
cntr--;
52-
}
53-
52+
}
53+
5454
if(args[cntr] instanceof Buffer) {
5555
head = args[cntr];
5656
}
5757

58-
options.ee.emit(ev + 'begin', req, res);
58+
options.ee.emit(ev + 'begin', req, res);
5959

6060
['target', 'forward'].forEach(
61-
function(e) {
61+
function(e) {
6262
if (typeof options[e] === 'string')
63-
options[e] = parse_url(options[e]);
63+
options[e] = parse_url(options[e]);
6464
});
6565

6666
passes.some(function(pass) {
@@ -74,16 +74,16 @@ function createRightProxy(type) {
7474
* refer to the connection socket
7575
* pass(req, socket, options, head)
7676
*/
77-
78-
options.ee.emit(evnt + 'begin', req, res);
79-
var val = pass(req, res, options, head);
77+
78+
options.ee.emit(evnt + 'begin', req, res);
79+
var val = pass(req, res, options, head);
8080
options.ee.emit(evnt + 'end');
81-
81+
8282
return val;
8383
});
8484

8585
options.ee.emit(ev + 'end');
86-
};
86+
};
8787
};
8888
}
8989

lib/caronte/passes/web-incoming.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ web_o = Object.keys(web_o).map(function(pass) {
1010

1111
/*!
1212
* Array of passes.
13-
*
13+
*
1414
* A `pass` is just a function that is executed on `req, res, options`
1515
* so that you can easily add new checks while still keeping the base
1616
* flexible.
@@ -22,7 +22,7 @@ web_o = Object.keys(web_o).map(function(pass) {
2222
* Sets `content-length` to '0' if request is of DELETE type.
2323
*
2424
* @param {ClientRequest} Req Request object
25-
* @param {IncomingMessage} Res Response object
25+
* @param {IncomingMessage} Res Response object
2626
* @param {Object} Options Config object passed to the proxy
2727
*
2828
* @api private
@@ -38,7 +38,7 @@ function deleteLength(req, res, options) {
3838
* Sets timeout in request socket if it was specified in options.
3939
*
4040
* @param {ClientRequest} Req Request object
41-
* @param {IncomingMessage} Res Response object
41+
* @param {IncomingMessage} Res Response object
4242
* @param {Object} Options Config object passed to the proxy
4343
*
4444
* @api private
@@ -54,7 +54,7 @@ function timeout(req, res, options) {
5454
* Sets `x-forwarded-*` headers if specified in config.
5555
*
5656
* @param {ClientRequest} Req Request object
57-
* @param {IncomingMessage} Res Response object
57+
* @param {IncomingMessage} Res Response object
5858
* @param {Object} Options Config object passed to the proxy
5959
*
6060
* @api private
@@ -70,7 +70,7 @@ function XHeaders(req, res, options) {
7070
};
7171

7272
['for', 'port', 'proto'].forEach(function(header) {
73-
req.headers['x-forwarded-' + header] =
73+
req.headers['x-forwarded-' + header] =
7474
(req.headers['x-forwarded-' + header] || '') +
7575
(req.headers['x-forwarded-' + header] ? ',' : '') +
7676
values[header]
@@ -83,7 +83,7 @@ function XHeaders(req, res, options) {
8383
* just dies otherwise.
8484
*
8585
* @param {ClientRequest} Req Request object
86-
* @param {IncomingMessage} Res Response object
86+
* @param {IncomingMessage} Res Response object
8787
* @param {Object} Options Config object passed to the proxy
8888
*
8989
* @api private
@@ -112,40 +112,40 @@ function stream(req, res, options) {
112112
throw err;
113113
}
114114
// Also emit the error events
115-
options.ee.emit(ev + 'error', err, req, res);
115+
options.ee.emit(ev + 'error', err, req, res);
116116
});
117-
117+
118118
req.pipe(proxyReq);
119119

120120
proxyReq.on('response', function(proxyRes) {
121121
var ev = 'caronte:outgoing:web:';
122122

123-
options.ee.emit(ev + 'begin', req, res);
124-
123+
options.ee.emit(ev + 'begin', req, res);
124+
125125
// When the previous request respond, we apply the
126126
// outgoing passes to the response
127127
web_o.some(function(pass) {
128128
var evnt = ev + pass.name.toLowerCase() + ':';
129-
129+
130130
options.ee.emit(evnt + 'begin', req, res);
131131
// Call the pass with the proxy response
132132
// pass(ClientRequest, IncomingMessage, proxyResponse)
133-
var val = pass(req, res, proxyRes);
133+
var val = pass(req, res, proxyRes);
134134
options.ee.emit(evnt + 'end');
135-
135+
136136
return val;
137137
});
138138

139139
options.ee.emit(ev + 'end');
140140

141141

142-
proxyRes.pipe(res);
142+
proxyRes.pipe(res);
143143
});
144144

145145
//proxyReq.end();
146146
}
147147

148148
] // <--
149149
.forEach(function(func) {
150-
passes[func.name] = func;
150+
passes[func.name] = func;
151151
});

lib/caronte/passes/web-outgoing.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var passes = exports;
22

33
/*!
44
* Array of passes.
5-
*
5+
*
66
* A `pass` is just a function that is executed on `req, res, options`
77
* so that you can easily add new checks while still keeping the base
88
* flexible.
@@ -14,7 +14,7 @@ var passes = exports;
1414
* If is a HTTP 1.0 request, remove chunk headers
1515
*
1616
* @param {ClientRequest} Req Request object
17-
* @param {IncomingMessage} Res Response object
17+
* @param {IncomingMessage} Res Response object
1818
* @param {proxyResponse} Res Response object from the proxy request
1919
*
2020
* @api private
@@ -30,7 +30,7 @@ var passes = exports;
3030
* or if connection header not present, then use `keep-alive`
3131
*
3232
* @param {ClientRequest} Req Request object
33-
* @param {IncomingMessage} Res Response object
33+
* @param {IncomingMessage} Res Response object
3434
* @param {proxyResponse} Res Response object from the proxy request
3535
*
3636
* @api private
@@ -55,7 +55,7 @@ var passes = exports;
5555
* set each header in response object.
5656
*
5757
* @param {ClientRequest} Req Request object
58-
* @param {IncomingMessage} Res Response object
58+
* @param {IncomingMessage} Res Response object
5959
* @param {proxyResponse} Res Response object from the proxy request
6060
*
6161
* @api private
@@ -70,7 +70,7 @@ var passes = exports;
7070
* Set the statusCode from the proxyResponse
7171
*
7272
* @param {ClientRequest} Req Request object
73-
* @param {IncomingMessage} Res Response object
73+
* @param {IncomingMessage} Res Response object
7474
* @param {proxyResponse} Res Response object from the proxy request
7575
*
7676
* @api private
@@ -81,5 +81,5 @@ var passes = exports;
8181

8282
] // <--
8383
.forEach(function(func) {
84-
passes[func.name] = func;
84+
passes[func.name] = func;
8585
});

0 commit comments

Comments
 (0)