File tree 2 files changed +10
-10
lines changed
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 27
27
var sys = require ( 'sys' ) ,
28
28
colors = require ( 'colors' )
29
29
http = require ( 'http' ) ,
30
- httpProxy = require ( 'http-proxy' ) . HttpProxy ;
30
+ httpProxy = require ( './lib/node- http-proxy' ) ;
31
31
32
32
// ascii art from http://github.com/marak/asciimo
33
33
var welcome = '\
@@ -40,13 +40,13 @@ var welcome = '\
40
40
sys . puts ( welcome . rainbow . bold ) ;
41
41
42
42
// create regular http proxy server
43
- httpProxy . createServer ( 'localhost' , ' 9000' ) . listen ( 8000 ) ;
43
+ httpProxy . createServer ( 'localhost' , 9000 ) . listen ( 8000 ) ;
44
44
sys . puts ( 'http proxy server' . blue + ' started ' . green . bold + 'on port ' . blue + '8000' . yellow ) ;
45
45
46
46
// http proxy server with latency
47
47
httpProxy . createServer ( function ( req , res , proxy ) {
48
48
setTimeout ( function ( ) {
49
- proxy . proxyRequest ( 'localhost' , ' 9000' , req , res ) ;
49
+ proxy . proxyRequest ( 'localhost' , 9000 , req , res ) ;
50
50
} , 200 )
51
51
} ) . listen ( 8001 ) ;
52
52
sys . puts ( 'http proxy server ' . blue + 'started ' . green . bold + 'on port ' . blue + '8001 ' . yellow + 'with latency' . magenta . underline ) ;
Original file line number Diff line number Diff line change 25
25
*/
26
26
27
27
var sys = require ( 'sys' ) ,
28
+ eyes = require ( 'eyes' ) ,
28
29
http = require ( 'http' ) ,
29
30
events = require ( 'events' ) ;
30
31
@@ -37,7 +38,7 @@ exports.HttpProxy = function () {
37
38
exports . createServer = function ( ) {
38
39
// Initialize the nodeProxy to start proxying requests
39
40
var proxy = new ( exports . HttpProxy ) ;
40
- return proxy . createServer ( arguments ) ;
41
+ return proxy . createServer . apply ( proxy , arguments ) ;
41
42
} ;
42
43
43
44
exports . HttpProxy . prototype = {
@@ -51,18 +52,17 @@ exports.HttpProxy.prototype = {
51
52
} ,
52
53
53
54
createServer : function ( ) {
54
- var args = Array . prototype . slice . call ( arguments ) ,
55
- self = this ,
55
+ var self = this ,
56
56
server ,
57
57
port ,
58
58
callback ;
59
59
60
- if ( typeof ( args [ 0 ] ) === "function" ) {
61
- callback = args [ 0 ] ;
60
+ if ( typeof ( arguments [ 0 ] ) === "function" ) {
61
+ callback = arguments [ 0 ] ;
62
62
}
63
63
else {
64
- server = args [ 0 ] ;
65
- port = args [ 1 ] ;
64
+ server = arguments [ 0 ] ;
65
+ port = arguments [ 1 ] ;
66
66
}
67
67
68
68
var proxyServer = http . createServer ( function ( req , res ) {
You can’t perform that action at this time.
0 commit comments