Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
node-http-proxy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
node-http-proxy
Commits
da55777a
Commit
da55777a
authored
Aug 01, 2010
by
indexzero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[api] Corrected chain of argument passing
parent
5d94ae27
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
demo.js
demo.js
+3
-3
lib/node-http-proxy.js
lib/node-http-proxy.js
+7
-7
No files found.
demo.js
View file @
da55777a
...
...
@@ -27,7 +27,7 @@
var
sys
=
require
(
'
sys
'
),
colors
=
require
(
'
colors
'
)
http
=
require
(
'
http
'
),
httpProxy
=
require
(
'
http-proxy
'
).
HttpProxy
;
httpProxy
=
require
(
'
./lib/node-http-proxy
'
)
;
// ascii art from http://github.com/marak/asciimo
var
welcome
=
'
\
...
...
@@ -40,13 +40,13 @@ var welcome = '\
sys
.
puts
(
welcome
.
rainbow
.
bold
);
// create regular http proxy server
httpProxy
.
createServer
(
'
localhost
'
,
'
9000
'
).
listen
(
8000
);
httpProxy
.
createServer
(
'
localhost
'
,
9000
).
listen
(
8000
);
sys
.
puts
(
'
http proxy server
'
.
blue
+
'
started
'
.
green
.
bold
+
'
on port
'
.
blue
+
'
8000
'
.
yellow
);
// http proxy server with latency
httpProxy
.
createServer
(
function
(
req
,
res
,
proxy
){
setTimeout
(
function
(){
proxy
.
proxyRequest
(
'
localhost
'
,
'
9000
'
,
req
,
res
);
proxy
.
proxyRequest
(
'
localhost
'
,
9000
,
req
,
res
);
},
200
)
}).
listen
(
8001
);
sys
.
puts
(
'
http proxy server
'
.
blue
+
'
started
'
.
green
.
bold
+
'
on port
'
.
blue
+
'
8001
'
.
yellow
+
'
with latency
'
.
magenta
.
underline
);
...
...
lib/node-http-proxy.js
View file @
da55777a
...
...
@@ -25,6 +25,7 @@
*/
var
sys
=
require
(
'
sys
'
),
eyes
=
require
(
'
eyes
'
),
http
=
require
(
'
http
'
),
events
=
require
(
'
events
'
);
...
...
@@ -37,7 +38,7 @@ exports.HttpProxy = function () {
exports
.
createServer
=
function
()
{
// Initialize the nodeProxy to start proxying requests
var
proxy
=
new
(
exports
.
HttpProxy
);
return
proxy
.
createServer
(
arguments
);
return
proxy
.
createServer
.
apply
(
proxy
,
arguments
);
};
exports
.
HttpProxy
.
prototype
=
{
...
...
@@ -51,18 +52,17 @@ exports.HttpProxy.prototype = {
},
createServer
:
function
()
{
var
args
=
Array
.
prototype
.
slice
.
call
(
arguments
),
self
=
this
,
var
self
=
this
,
server
,
port
,
callback
;
if
(
typeof
(
args
[
0
])
===
"
function
"
)
{
callback
=
args
[
0
];
if
(
typeof
(
arg
ument
s
[
0
])
===
"
function
"
)
{
callback
=
arg
ument
s
[
0
];
}
else
{
server
=
args
[
0
];
port
=
args
[
1
];
server
=
arg
ument
s
[
0
];
port
=
arg
ument
s
[
1
];
}
var
proxyServer
=
http
.
createServer
(
function
(
req
,
res
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment