mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
resume() can throw
This commit is contained in:
parent
37e2541891
commit
0c71119ee5
@ -238,7 +238,8 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
|
||||
if (!flushed) {
|
||||
response.pause();
|
||||
res.once('drain', function () {
|
||||
response.resume();
|
||||
try { response.resume() }
|
||||
catch (er) { console.error("response.resume error: %s", er.message) }
|
||||
});
|
||||
|
||||
//
|
||||
@ -287,7 +288,8 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
|
||||
if (!flushed) {
|
||||
req.pause();
|
||||
reverseProxy.once('drain', function () {
|
||||
req.resume();
|
||||
try { req.resume() }
|
||||
catch (er) { console.error("req.resume error: %s", er.message) }
|
||||
});
|
||||
|
||||
//
|
||||
@ -370,7 +372,8 @@ HttpProxy.prototype._forwardRequest = function (req) {
|
||||
if (!flushed) {
|
||||
req.pause();
|
||||
forwardProxy.once('drain', function () {
|
||||
req.resume();
|
||||
try { req.resume() }
|
||||
catch (er) { console.error("req.resume error: %s", er.message) }
|
||||
});
|
||||
|
||||
//
|
||||
@ -470,7 +473,8 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
|
||||
if (!flushed) {
|
||||
proxySocket.pause();
|
||||
reverseProxy.incoming.socket.once('drain', function () {
|
||||
proxySocket.resume();
|
||||
try { proxySocket.resume() }
|
||||
catch (er) { console.error("proxySocket.resume error: %s", er.message) }
|
||||
});
|
||||
|
||||
//
|
||||
@ -501,7 +505,8 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
|
||||
if (!flushed) {
|
||||
reverseProxy.incoming.socket.pause();
|
||||
proxySocket.once('drain', function () {
|
||||
reverseProxy.incoming.socket.resume();
|
||||
try { reverseProxy.incoming.socket.resume() }
|
||||
catch (er) { console.error("reverseProxy.incoming.socket.resume error: %s", er.message) }
|
||||
});
|
||||
|
||||
//
|
||||
@ -619,7 +624,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
|
||||
// This will force us not to disconnect.
|
||||
//
|
||||
// In addition, it's important to note the closure scope here. Since
|
||||
// there is no mapping of the
|
||||
// there is no mapping of the socket to the request bound to it.
|
||||
//
|
||||
if (!agent._events || agent._events['upgrade'].length === 0) {
|
||||
agent.on('upgrade', function (_, remoteSocket, head) {
|
||||
@ -673,7 +678,8 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
|
||||
if (!flushed) {
|
||||
reverseProxy.socket.pause();
|
||||
socket.once('drain', function () {
|
||||
reverseProxy.socket.resume();
|
||||
try { reverseProxy.socket.resume() }
|
||||
catch (er) { console.error("reverseProxy.socket.resume error: %s", er.message) }
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user