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
9ab54ab4
Commit
9ab54ab4
authored
May 17, 2011
by
indexzero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Refined tests to begin checking Origin == Sec-Websocket-Origin
parent
6e679c80
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
test/web-socket-proxy-test.js
test/web-socket-proxy-test.js
+16
-13
No files found.
test/web-socket-proxy-test.js
View file @
9ab54ab4
...
...
@@ -52,11 +52,12 @@ vows.describe('node-http-proxy/websocket').addBatch({
var
that
=
this
;
runner
.
startTargetServer
(
8130
,
'
hello websocket
'
,
function
(
err
,
target
)
{
var
socket
=
io
.
listen
(
target
);
var
socket
=
io
.
listen
(
target
),
headers
=
{};
socket
.
on
(
'
connection
'
,
function
(
client
)
{
client
.
on
(
'
message
'
,
function
(
msg
)
{
that
.
callback
(
null
,
msg
);
that
.
callback
(
null
,
msg
,
headers
);
});
});
...
...
@@ -65,12 +66,12 @@ vows.describe('node-http-proxy/websocket').addBatch({
// Setup the web socket against our proxy
//
var
ws
=
new
websocket
.
WebSocket
(
'
ws://localhost:8131/socket.io/websocket/
'
,
'
borf
'
,
{
origin
:
'
localhost
'
origin
:
'
http://
localhost
'
});
ws
.
on
(
'
wsupgrade
'
,
function
(
req
,
res
)
{
require
(
'
eyes
'
).
inspect
(
req
)
;
require
(
'
eyes
'
).
inspect
(
res
.
headers
)
;
headers
.
request
=
req
;
headers
.
response
=
res
.
headers
;
});
ws
.
on
(
'
open
'
,
function
()
{
...
...
@@ -79,8 +80,9 @@ vows.describe('node-http-proxy/websocket').addBatch({
});
});
},
"
the target server should receive the message
"
:
function
(
err
,
msg
)
{
"
the target server should receive the message
"
:
function
(
err
,
msg
,
headers
)
{
assert
.
equal
(
msg
,
'
from client
'
);
require
(
'
eyes
'
).
inspect
(
headers
);
}
},
"
when an outbound message is sent from the target server
"
:
{
...
...
@@ -88,7 +90,8 @@ vows.describe('node-http-proxy/websocket').addBatch({
var
that
=
this
;
runner
.
startTargetServer
(
8132
,
'
hello websocket
'
,
function
(
err
,
target
)
{
var
socket
=
io
.
listen
(
target
);
var
socket
=
io
.
listen
(
target
),
headers
=
{};
socket
.
on
(
'
connection
'
,
function
(
client
)
{
socket
.
broadcast
(
'
from server
'
);
...
...
@@ -99,26 +102,26 @@ vows.describe('node-http-proxy/websocket').addBatch({
// Setup the web socket against our proxy
//
var
ws
=
new
websocket
.
WebSocket
(
'
ws://localhost:8133/socket.io/websocket/
'
,
'
borf
'
,
{
origin
:
'
localhost
'
origin
:
'
http://
localhost
'
});
ws
.
on
(
'
wsupgrade
'
,
function
(
req
,
res
)
{
require
(
'
eyes
'
).
inspect
(
req
)
;
require
(
'
eyes
'
).
inspect
(
res
.
headers
)
;
headers
.
request
=
req
;
headers
.
response
=
res
.
headers
;
});
ws
.
on
(
'
message
'
,
function
(
msg
)
{
msg
=
utils
.
decode
(
msg
);
if
(
!
/
\d
+/
.
test
(
msg
))
{
that
.
callback
(
null
,
msg
);
that
.
callback
(
null
,
msg
,
headers
);
}
});
});
});
},
"
the client should receive the message
"
:
function
(
err
,
msg
)
{
"
the client should receive the message
"
:
function
(
err
,
msg
,
headers
)
{
assert
.
equal
(
msg
,
'
from server
'
);
require
(
'
eyes
'
).
inspect
(
headers
);
}
}
}
...
...
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