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
84be9f2c
Commit
84be9f2c
authored
Sep 02, 2011
by
isaacs
Committed by
indexzero
Sep 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Emit drain if it doesn't happen on its own in 100ms
parent
2b9e09b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
lib/node-http-proxy.js
lib/node-http-proxy.js
+24
-0
No files found.
lib/node-http-proxy.js
View file @
84be9f2c
...
@@ -551,10 +551,14 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
...
@@ -551,10 +551,14 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
}
}
}
}
if
(
!
flushed
)
{
if
(
!
flushed
)
{
//console.error('backpressure 554');
response
.
pause
();
response
.
pause
();
res
.
once
(
'
drain
'
,
function
()
{
res
.
once
(
'
drain
'
,
function
()
{
response
.
resume
();
response
.
resume
();
});
});
setTimeout
(
function
()
{
res
.
emit
(
'
drain
'
);
},
100
);
}
}
});
});
...
@@ -587,10 +591,14 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
...
@@ -587,10 +591,14 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
if
(
!
errState
)
{
if
(
!
errState
)
{
var
flushed
=
reverseProxy
.
write
(
chunk
);
var
flushed
=
reverseProxy
.
write
(
chunk
);
if
(
!
flushed
)
{
if
(
!
flushed
)
{
//console.error('backpressure 594');
req
.
pause
();
req
.
pause
();
reverseProxy
.
once
(
'
drain
'
,
function
()
{
reverseProxy
.
once
(
'
drain
'
,
function
()
{
req
.
resume
();
req
.
resume
();
});
});
setTimeout
(
function
()
{
reverseProxy
.
emit
(
'
drain
'
);
},
100
);
}
}
}
}
});
});
...
@@ -661,10 +669,14 @@ HttpProxy.prototype._forwardRequest = function (req) {
...
@@ -661,10 +669,14 @@ HttpProxy.prototype._forwardRequest = function (req) {
req
.
on
(
'
data
'
,
function
(
chunk
)
{
req
.
on
(
'
data
'
,
function
(
chunk
)
{
var
flushed
=
forwardProxy
.
write
(
chunk
);
var
flushed
=
forwardProxy
.
write
(
chunk
);
if
(
!
flushed
)
{
if
(
!
flushed
)
{
//console.error('backpressure 672');
req
.
pause
();
req
.
pause
();
forwardProxy
.
once
(
'
drain
'
,
function
()
{
forwardProxy
.
once
(
'
drain
'
,
function
()
{
req
.
resume
();
req
.
resume
();
});
});
setTimeout
(
function
()
{
forwardProxy
.
emit
(
'
drain
'
);
},
100
);
}
}
})
})
...
@@ -762,10 +774,14 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
...
@@ -762,10 +774,14 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
self
.
emit
(
'
websocket:outgoing
'
,
req
,
socket
,
head
,
data
);
self
.
emit
(
'
websocket:outgoing
'
,
req
,
socket
,
head
,
data
);
var
flushed
=
reverseProxy
.
incoming
.
socket
.
write
(
data
);
var
flushed
=
reverseProxy
.
incoming
.
socket
.
write
(
data
);
if
(
!
flushed
)
{
if
(
!
flushed
)
{
//console.error('backpressure 777');
proxySocket
.
pause
();
proxySocket
.
pause
();
reverseProxy
.
incoming
.
socket
.
once
(
'
drain
'
,
function
()
{
reverseProxy
.
incoming
.
socket
.
once
(
'
drain
'
,
function
()
{
proxySocket
.
resume
();
proxySocket
.
resume
();
});
});
setTimeout
(
function
()
{
reverseProxy
.
incoming
.
socket
.
emit
(
'
drain
'
);
},
100
);
}
}
}
}
catch
(
e
)
{
catch
(
e
)
{
...
@@ -785,10 +801,14 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
...
@@ -785,10 +801,14 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
self
.
emit
(
'
websocket:incoming
'
,
reverseProxy
,
reverseProxy
.
incoming
,
head
,
data
);
self
.
emit
(
'
websocket:incoming
'
,
reverseProxy
,
reverseProxy
.
incoming
,
head
,
data
);
var
flushed
=
proxySocket
.
write
(
data
);
var
flushed
=
proxySocket
.
write
(
data
);
if
(
!
flushed
)
{
if
(
!
flushed
)
{
//console.error('backpressure 804');
reverseProxy
.
incoming
.
socket
.
pause
();
reverseProxy
.
incoming
.
socket
.
pause
();
proxySocket
.
once
(
'
drain
'
,
function
()
{
proxySocket
.
once
(
'
drain
'
,
function
()
{
reverseProxy
.
incoming
.
socket
.
resume
();
reverseProxy
.
incoming
.
socket
.
resume
();
});
});
setTimeout
(
function
()
{
proxySocket
.
emit
(
'
drain
'
);
},
100
);
}
}
}
}
catch
(
e
)
{
catch
(
e
)
{
...
@@ -951,10 +971,14 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
...
@@ -951,10 +971,14 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
socket
.
write
(
sdata
);
socket
.
write
(
sdata
);
var
flushed
=
socket
.
write
(
data
);
var
flushed
=
socket
.
write
(
data
);
if
(
!
flushed
)
{
if
(
!
flushed
)
{
//console.error('backpressure 974');
reverseProxy
.
socket
.
pause
();
reverseProxy
.
socket
.
pause
();
socket
.
once
(
'
drain
'
,
function
()
{
socket
.
once
(
'
drain
'
,
function
()
{
reverseProxy
.
socket
.
resume
();
reverseProxy
.
socket
.
resume
();
});
});
setTimeout
(
function
()
{
socket
.
emit
(
'
drain
'
);
},
100
);
}
}
}
}
...
...
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