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
5d0bbb38
Commit
5d0bbb38
authored
Aug 18, 2011
by
indexzero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[minor dist] Use `pkginfo`. Minor updates to variable scoping in `.createServer()`
parent
d8068a83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
30 deletions
+9
-30
lib/node-http-proxy.js
lib/node-http-proxy.js
+7
-29
package.json
package.json
+2
-1
No files found.
lib/node-http-proxy.js
View file @
5d0bbb38
...
...
@@ -32,9 +32,9 @@ var util = require('util'),
maxSockets
=
100
;
//
//
### Version 0.5.7 // 5/19/2011
//
Expose version information through `pkginfo`.
//
exports
.
version
=
[
0
,
5
,
7
]
;
require
(
'
pkginfo
'
)(
module
,
'
version
'
)
;
//
// Track our own list of agents internal to `node-http-proxy`
...
...
@@ -113,30 +113,6 @@ exports.getMaxSockets = function () {
exports
.
setMaxSockets
=
function
(
value
)
{
maxSockets
=
value
;
};
//
// stack
// adapted from https://github.com/creationix/stack
//
function
stack
(
middlewares
,
proxy
)
{
var
handle
;
middlewares
.
reverse
().
forEach
(
function
(
layer
)
{
var
child
=
handle
;
var
next
=
function
(
err
)
{
if
(
err
)
{
throw
err
;
//return error(req, res, err);
}
child
(
req
,
res
);
}
next
.
__proto__
=
proxy
;
handle
=
function
(
req
,
res
)
{
layer
(
req
,
res
,
next
);
};
});
return
handle
;
}
//
// stack
...
...
@@ -185,6 +161,7 @@ exports.createServer = function () {
proxy
,
server
,
options
=
{},
middleware
=
[],
handler
,
silent
;
args
.
forEach
(
function
(
arg
)
{
...
...
@@ -196,7 +173,7 @@ exports.createServer = function () {
};
});
var
proxy
=
new
HttpProxy
(
options
);
proxy
=
new
HttpProxy
(
options
);
if
(
port
&&
host
)
{
//
...
...
@@ -232,7 +209,9 @@ exports.createServer = function () {
handler
=
callback
=
stack
(
middleware
,
proxy
);
}
else
if
(
middleware
.
length
)
{
//do not use middleware code if it's not needed.
//
// Do not use middleware code if it's not needed.
//
var
h
=
middleware
[
0
];
handler
=
callback
=
function
(
req
,
res
)
{
h
(
req
,
res
,
proxy
)
};
}
...
...
@@ -273,7 +252,6 @@ exports.createServer = function () {
// to the consumer of the server
//
server
.
proxy
=
proxy
;
return
server
;
};
...
...
package.json
View file @
5d0bbb38
...
...
@@ -15,7 +15,8 @@
"keywords"
:
[
"reverse"
,
"proxy"
,
"http"
],
"dependencies"
:
{
"
colors
"
:
"
0.x.x
"
,
"
optimist
"
:
"
0.2.x
"
"
optimist
"
:
"
0.2.x
"
,
"
pkginfo
"
:
"
0.2.x
"
},
"devDependencies"
:
{
"
request
"
:
"
1.9.x
"
,
...
...
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