Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
7cad1542
Commit
7cad1542
authored
Mar 26, 2014
by
Solly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #347 from dol/fix/better-ws-binarytype-detection
Improved websocket binary support detection
parents
23817e15
97362c39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
rfb.js
include/rfb.js
+4
-8
websock.js
include/websock.js
+10
-6
No files found.
include/rfb.js
View file @
7cad1542
...
...
@@ -296,17 +296,13 @@ function connect() {
var
uri
;
if
(
typeof
UsingSocketIO
!==
"undefined"
)
{
uri
=
"http
://"
+
rfb_host
+
":"
+
rfb_port
+
"/"
+
rfb_path
;
uri
=
"http
"
;
}
else
{
if
(
conf
.
encrypt
)
{
uri
=
"wss://"
;
}
else
{
uri
=
"ws://"
;
}
uri
+=
rfb_host
+
":"
+
rfb_port
+
"/"
+
rfb_path
;
uri
=
conf
.
encrypt
?
"wss"
:
"ws"
;
}
uri
+=
"://"
+
rfb_host
+
":"
+
rfb_port
+
"/"
+
rfb_path
;
Util
.
Info
(
"connecting to "
+
uri
);
// TODO: make protocols a configurable
ws
.
open
(
uri
,
conf
.
wsProtocols
);
Util
.
Debug
(
"<< RFB.connect"
);
...
...
include/websock.js
View file @
7cad1542
...
...
@@ -262,7 +262,7 @@ function on(evt, handler) {
eventHandlers
[
evt
]
=
handler
;
}
function
init
(
protocols
)
{
function
init
(
protocols
,
ws_schema
)
{
rQ
=
[];
rQi
=
0
;
sQ
=
[];
...
...
@@ -278,11 +278,14 @@ function init(protocols) {
bt
=
true
;
}
// Check for full binary type support in WebSockets
// TODO: this sucks, the property should exist on the prototype
// but it does not.
// Check for full binary type support in WebSocket
// Inspired by:
// https://github.com/Modernizr/Modernizr/issues/370
// https://github.com/Modernizr/Modernizr/blob/master/feature-detects/websockets/binary.js
try
{
if
(
bt
&&
(
'binaryType'
in
(
new
WebSocket
(
"wss://localhost:17523"
))))
{
if
(
bt
&&
(
'binaryType'
in
WebSocket
.
prototype
||
!!
(
new
WebSocket
(
ws_schema
+
'://.'
).
binaryType
)))
{
Util
.
Info
(
"Detected binaryType support in WebSockets"
);
wsbt
=
true
;
}
...
...
@@ -325,7 +328,8 @@ function init(protocols) {
}
function
open
(
uri
,
protocols
)
{
protocols
=
init
(
protocols
);
var
ws_schema
=
uri
.
match
(
/^
([
a-z
]
+
)
:
\/\/
/
)[
1
];
protocols
=
init
(
protocols
,
ws_schema
);
if
(
test_mode
)
{
websocket
=
{};
...
...
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