Skip to content

Commit

Permalink
support forward
Browse files Browse the repository at this point in the history
  • Loading branch information
yawnt committed Sep 14, 2013
1 parent 031aa0f commit 8c8c455
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
18 changes: 12 additions & 6 deletions lib/caronte/passes/web.js
@@ -1,9 +1,7 @@
var ForwardStream = require('../streams/forward'),
ProxyStream = require('../streams/proxy'),
http = require('http'),
https = require('https'),
common = require('../common'),
passes = exports;
var http = require('http'),
https = require('https'),
common = require('../common'),
passes = exports;

/*!
* Array of passes.
Expand Down Expand Up @@ -87,6 +85,14 @@ function XHeaders(req, res, options) {
*/

function stream(req, res, options) {
if(options.forward) {
var forwardReq = (options.ssl ? https : http).request(
common.setupOutgoing(options.ssl || {}, options, req, 'forward')
);
req.pipe(forwardReq);
return res.end();
}

var proxyReq = (options.ssl ? https : http).request(
common.setupOutgoing(options.ssl || {}, options, req)
);
Expand Down
3 changes: 2 additions & 1 deletion ttest.js
Expand Up @@ -32,13 +32,14 @@ client.on('open', function() {

caronte.createProxyServer({
ws : true,
target: 'http://127.0.0.1:9090'
forward: 'http://127.0.0.1:9090'
}).listen(8080);



var srv = http.createServer(function(req, res) {
res.end('ciao proxy');
console.log('suca');
}).listen(9090);
/*
srv.on('upgrade', function(req, sock, head) {
Expand Down

0 comments on commit 8c8c455

Please sign in to comment.