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
f1a8b573
Commit
f1a8b573
authored
Dec 23, 2011
by
indexzero
Committed by
Cédric de Saint Martin
Jan 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[refactor] Listen for `socket` events since reverseProxy.socket is no longer set synchronously
parent
bdd6352d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
lib/node-http-proxy/http-proxy.js
lib/node-http-proxy/http-proxy.js
+8
-8
No files found.
lib/node-http-proxy/http-proxy.js
View file @
f1a8b573
...
...
@@ -663,8 +663,8 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
// If the reverseProxy connection has an underlying socket,
// then execute the WebSocket handshake.
//
if
(
typeof
reverseProxy
.
socket
!==
'
undefined
'
)
{
rev
erseProxy
.
s
ocket
.
on
(
'
data
'
,
function
handshake
(
data
)
{
reverseProxy
.
once
(
'
socket
'
,
function
(
revSocket
)
{
rev
S
ocket
.
on
(
'
data
'
,
function
handshake
(
data
)
{
//
// Ok, kind of harmfull part of code. Socket.IO sends a hash
// at the end of handshake if protocol === 76, but we need
...
...
@@ -697,9 +697,9 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
socket
.
write
(
sdata
);
var
flushed
=
socket
.
write
(
data
);
if
(
!
flushed
)
{
rev
erseProxy
.
s
ocket
.
pause
();
rev
S
ocket
.
pause
();
socket
.
once
(
'
drain
'
,
function
()
{
try
{
rev
erseProxy
.
s
ocket
.
resume
()
}
try
{
rev
S
ocket
.
resume
()
}
catch
(
er
)
{
console
.
error
(
"
reverseProxy.socket.resume error: %s
"
,
er
.
message
)
}
});
...
...
@@ -717,7 +717,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
// Remove data listener on socket error because the
// 'handshake' has failed.
//
rev
erseProxy
.
s
ocket
.
removeListener
(
'
data
'
,
handshake
);
rev
S
ocket
.
removeListener
(
'
data
'
,
handshake
);
return
proxyError
(
ex
);
}
...
...
@@ -727,9 +727,9 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
//
// Remove data listener now that the 'handshake' is complete
//
reverseProxy
.
socket
.
removeListener
(
'
data
'
,
handshake
);
revSocket
.
removeListener
(
'
data
'
,
handshake
);
});
});
}
reverseProxy
.
on
(
'
error
'
,
proxyError
);
...
...
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