Skip to content

Commit 8c8c455

Browse files
committed
support forward
1 parent 031aa0f commit 8c8c455

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Diff for: lib/caronte/passes/web.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
var ForwardStream = require('../streams/forward'),
2-
ProxyStream = require('../streams/proxy'),
3-
http = require('http'),
4-
https = require('https'),
5-
common = require('../common'),
6-
passes = exports;
1+
var http = require('http'),
2+
https = require('https'),
3+
common = require('../common'),
4+
passes = exports;
75

86
/*!
97
* Array of passes.
@@ -87,6 +85,14 @@ function XHeaders(req, res, options) {
8785
*/
8886

8987
function stream(req, res, options) {
88+
if(options.forward) {
89+
var forwardReq = (options.ssl ? https : http).request(
90+
common.setupOutgoing(options.ssl || {}, options, req, 'forward')
91+
);
92+
req.pipe(forwardReq);
93+
return res.end();
94+
}
95+
9096
var proxyReq = (options.ssl ? https : http).request(
9197
common.setupOutgoing(options.ssl || {}, options, req)
9298
);

Diff for: ttest.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ client.on('open', function() {
3232

3333
caronte.createProxyServer({
3434
ws : true,
35-
target: 'http://127.0.0.1:9090'
35+
forward: 'http://127.0.0.1:9090'
3636
}).listen(8080);
3737

3838

3939

4040
var srv = http.createServer(function(req, res) {
4141
res.end('ciao proxy');
42+
console.log('suca');
4243
}).listen(9090);
4344
/*
4445
srv.on('upgrade', function(req, sock, head) {

0 commit comments

Comments
 (0)