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
d8c54063
Commit
d8c54063
authored
Mar 09, 2011
by
indexzero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[minor doc] Update demo and small fix to node-http-proxy
parent
389159da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
demo.js
demo.js
+5
-4
lib/node-http-proxy.js
lib/node-http-proxy.js
+2
-1
No files found.
demo.js
View file @
d8c54063
...
...
@@ -60,8 +60,9 @@ util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue +
// Http Proxy Server with Latency
//
httpProxy
.
createServer
(
function
(
req
,
res
,
proxy
)
{
var
paused
=
proxy
.
pause
(
req
);
setTimeout
(
function
()
{
proxy
.
proxyRequest
(
9000
,
'
localhost
'
);
proxy
.
proxyRequest
(
req
,
res
,
9000
,
'
localhost
'
,
paused
);
},
200
)
}).
listen
(
8002
);
util
.
puts
(
'
http proxy server
'
.
blue
+
'
started
'
.
green
.
bold
+
'
on port
'
.
blue
+
'
8002
'
.
yellow
+
'
with latency
'
.
magenta
.
underline
);
...
...
@@ -80,11 +81,11 @@ util.puts('http proxy server '.blue + 'started '.green.bold + 'on port '.blue +
//
// Http Server with proxyRequest Handler and Latency
//
var
standAloneProxy
=
new
httpProxy
.
HttpProxy
();
http
.
createServer
(
function
(
req
,
res
)
{
var
proxy
=
new
httpProxy
.
HttpProxy
(
req
,
res
);
var
paused
=
standAloneProxy
.
pause
(
req
);
setTimeout
(
function
()
{
proxy
.
proxyRequest
(
9000
,
'
localhost
'
);
proxy
.
proxyRequest
(
req
,
res
,
9000
,
'
localhost
'
,
paused
);
},
200
);
}).
listen
(
8004
);
util
.
puts
(
'
http server
'
.
blue
+
'
started
'
.
green
.
bold
+
'
on port
'
.
blue
+
'
8004
'
.
yellow
+
'
with proxyRequest handler
'
.
cyan
.
underline
+
'
and latency
'
.
magenta
);
...
...
lib/node-http-proxy.js
View file @
d8c54063
...
...
@@ -114,6 +114,8 @@ exports.createServer = function () {
var
HttpProxy
=
exports
.
HttpProxy
=
function
(
options
)
{
events
.
EventEmitter
.
call
(
this
);
options
=
options
||
{};
this
.
options
=
options
;
if
(
options
.
router
)
{
...
...
@@ -184,7 +186,6 @@ HttpProxy.prototype.proxyRequest = function (req, res, port, host, paused) {
// always ignore the proxyTable if an explicit `port` and `host`
// arguments are supplied to `proxyRequest`.
//
if
(
this
.
proxyTable
&&
!
host
)
{
location
=
this
.
proxyTable
.
getProxyLocation
(
req
);
...
...
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