mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
support websockets
This commit is contained in:
parent
0fb33810f5
commit
4a4607d075
@ -30,11 +30,24 @@ function createRightProxy(type) {
|
||||
return passes[pass];
|
||||
});
|
||||
|
||||
return function(req, res, opts) {
|
||||
return function(req, res /*, [head], [opts] */) {
|
||||
var self = this,
|
||||
ev = 'caronte:' + type + ':';
|
||||
args = [].slice.call(arguments),
|
||||
cntr = args.length - 1,
|
||||
ev = 'caronte:' + type + ':',
|
||||
head;
|
||||
|
||||
if(typeof opts !== 'undefined') { options = opts; }
|
||||
if(
|
||||
!(args[cntr] instanceof Buffer) &&
|
||||
args[cntr] !== res
|
||||
) {
|
||||
options = opts;
|
||||
cntr--;
|
||||
}
|
||||
|
||||
if(args[cntr] instanceof Buffer) {
|
||||
head = args[cntr];
|
||||
}
|
||||
|
||||
options.ee.emit(ev + 'begin', req, res);
|
||||
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
var WebsocketStream = require('../streams/websocket'),
|
||||
passes = exports;
|
||||
|
||||
/*!
|
||||
* Array of passes.
|
||||
*
|
||||
|
||||
@ -15,7 +15,8 @@
|
||||
"dox" : "*",
|
||||
"coveralls" : "*",
|
||||
"mocha-lcov-reporter": "*",
|
||||
"blanket" : "*"
|
||||
"blanket" : "*",
|
||||
"ws" : "*"
|
||||
},
|
||||
"scripts" : {
|
||||
"blanket" : { "pattern": "caronte/lib" },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user