Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
987f7dba
Commit
987f7dba
authored
1 year ago
by
rickparrish
Browse files
Options
Downloads
Patches
Plain Diff
Replace the UseBinary flag with a SubProtocol check
parent
f3564872
No related branches found
No related tags found
1 merge request
!330
Add support for binary frames to websocket service
Pipeline
#4694
passed
1 year ago
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/websocketservice.js
+7
-7
7 additions, 7 deletions
exec/websocketservice.js
with
7 additions
and
7 deletions
exec/websocketservice.js
+
7
−
7
View file @
987f7dba
...
...
@@ -45,7 +45,7 @@ var FServerSocket = null;
var
FWebSocketDataQueue
=
''
;
var
FWebSocketHeader
=
{};
var
FWebSocketState
=
WEBSOCKET_NEED_PACKET_START
;
var
FWebSocket
UseBinary
=
false
;
var
FWebSocket
SubProtocol
=
''
;
var
ipFile
;
// Main line
...
...
@@ -456,7 +456,7 @@ function SendToWebSocketClientDraft0(AData) {
function
SendToWebSocketClientVersion7
(
AData
)
{
var
ToSend
=
''
;
if
(
FWebSocket
UseB
inary
)
{
if
(
FWebSocket
SubProtocol
===
'
b
inary
'
)
{
for
(
var
i
=
0
;
i
<
AData
.
length
;
i
++
)
{
ToSend
+=
String
.
fromCharCode
(
AData
[
i
]);
}
...
...
@@ -660,16 +660,16 @@ function ShakeHandsVersion7() {
"
Sec-WebSocket-Accept:
"
+
Encoded
+
"
\r\n
"
;
if
(
'
SubProtocol
'
in
FWebSocketHeader
)
{
if
(
FWebSocketHeader
[
'
SubProtocol
'
].
indexOf
(
'
binary
'
)
>=
0
)
{
log
(
LOG_DEBUG
,
'
Selecting "binary" SubProtocol
'
);
Response
+=
"
Sec-WebSocket-Protocol: binary
\r\n
"
;
FWebSocketUseBinary
=
true
;
FWebSocketSubProtocol
=
'
binary
'
;
}
else
if
(
FWebSocketHeader
[
'
SubProtocol
'
].
indexOf
(
'
plain
'
)
>=
0
)
{
log
(
LOG_DEBUG
,
'
Selecting "plain" SubProtocol
'
);
Response
+=
"
Sec-WebSocket-Protocol: plain
\r\n
"
;
FWebSocketSubProtocol
=
'
plain
'
;
}
else
{
log
(
LOG_ERR
,
'
No supported SubProtocols found ("binary" and "plain" are only supported options
'
);
return
false
;
}
log
(
LOG_DEBUG
,
'
Selecting "
'
+
FWebSocketSubProtocol
+
'
" SubProtocol
'
);
Response
+=
"
Sec-WebSocket-Protocol:
"
+
FWebSocketSubProtocol
+
"
\r\n
"
;
}
Response
+=
"
\r\n
"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment