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
44a85664
Commit
44a85664
authored
May 17, 2011
by
indexzero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Continued work around Origin mismatch tests
parent
9ab54ab4
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
115 deletions
+126
-115
lib/node-http-proxy.js
lib/node-http-proxy.js
+4
-3
test/web-socket-proxy-test.js
test/web-socket-proxy-test.js
+9
-5
vendor/websocket.js
vendor/websocket.js
+113
-107
No files found.
lib/node-http-proxy.js
View file @
44a85664
...
...
@@ -588,12 +588,13 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options
_socket
(
socket
);
// Remote host address
var
agent
=
_getAgent
(
options
.
host
,
options
.
port
),
remoteHost
=
options
.
host
+
(
options
.
port
-
80
===
0
?
''
:
'
:
'
+
options
.
port
);
var
protocolName
=
options
.
https
||
this
.
https
?
'
https
'
:
'
http
'
,
agent
=
_getAgent
(
options
.
host
,
options
.
port
),
remoteHost
=
options
.
host
+
(
options
.
port
-
80
===
0
?
''
:
'
:
'
+
options
.
port
);
// Change headers
req
.
headers
.
host
=
remoteHost
;
req
.
headers
.
origin
=
'
http
://
'
+
options
.
host
;
req
.
headers
.
origin
=
protocolName
+
'
://
'
+
options
.
host
;
outgoing
=
{
host
:
options
.
host
,
...
...
test/web-socket-proxy-test.js
View file @
44a85664
...
...
@@ -29,6 +29,7 @@ var vows = require('vows'),
colors
=
require
(
'
colors
'
),
request
=
require
(
'
request
'
),
assert
=
require
(
'
assert
'
),
argv
=
require
(
'
optimist
'
).
argv
,
websocket
=
require
(
'
./../vendor/websocket
'
),
helpers
=
require
(
'
./helpers
'
);
...
...
@@ -42,8 +43,11 @@ catch (ex) {
process
.
exit
(
1
);
}
var
runner
=
new
helpers
.
TestRunner
();
var
protocol
=
argv
.
https
?
'
https
'
:
'
http
'
,
wsprotocol
=
argv
.
https
?
'
wss
'
:
'
ws
'
,
runner
=
new
helpers
.
TestRunner
(
protocol
);
require
(
'
eyes
'
).
inspect
(
protocol
);
vows
.
describe
(
'
node-http-proxy/websocket
'
).
addBatch
({
"
When using server created by httpProxy.createServer()
"
:
{
"
with no latency
"
:
{
...
...
@@ -65,8 +69,8 @@ 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
:
'
http://localhost
'
var
ws
=
new
websocket
.
WebSocket
(
wsprotocol
+
'
://localhost:8131/socket.io/websocket/
'
,
'
borf
'
,
{
origin
:
'
http
s
://localhost
'
});
ws
.
on
(
'
wsupgrade
'
,
function
(
req
,
res
)
{
...
...
@@ -101,8 +105,8 @@ 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
:
'
http://localhost
'
var
ws
=
new
websocket
.
WebSocket
(
wsprotocol
+
'
://localhost:8133/socket.io/websocket/
'
,
'
borf
'
,
{
origin
:
'
http
s
://localhost
'
});
ws
.
on
(
'
wsupgrade
'
,
function
(
req
,
res
)
{
...
...
vendor/websocket.js
View file @
44a85664
This diff is collapsed.
Click to expand it.
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