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
93434d07
Commit
93434d07
authored
5 months ago
by
Rick Parrish
Committed by
Rob Swindell
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#782
- websocketservice.js garbles input on Banana Pi running Armbian
parent
29a35642
No related branches found
No related tags found
1 merge request
!458
Fix #782 - websocketservice.js garbles input on Banana Pi running Armbian
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/websocketservice.js
+14
-5
14 additions, 5 deletions
exec/websocketservice.js
with
14 additions
and
5 deletions
exec/websocketservice.js
+
14
−
5
View file @
93434d07
...
...
@@ -37,9 +37,9 @@ const WEBSOCKET_FRAME_BINARY = 2;
// Global variables
var
FFrameMask
=
[];
var
FFrameMasked
=
false
;
var
FFrameMaskIndex
=
0
;
var
FFrameOpCode
=
0
;
var
FFramePayloadLength
=
0
;
var
FFramePayloadReceived
=
0
;
var
FFrameType
=
WEBSOCKET_FRAME_UNKNOWN
;
var
FServerSocket
=
null
;
var
FWebSocketDataQueue
=
''
;
...
...
@@ -299,8 +299,8 @@ function GetFromWebSocketClientVersion7() {
// If we get here, we want to move on to the next state
FFrameMask
=
[];
FFrameMasked
=
false
;
FFrameMaskIndex
=
0
;
FFramePayloadLength
=
0
;
FFramePayloadReceived
=
0
;
FWebSocketState
=
WEBSOCKET_NEED_PAYLOAD_LENGTH
;
break
;
case
WEBSOCKET_NEED_PAYLOAD_LENGTH
:
...
...
@@ -348,7 +348,10 @@ function GetFromWebSocketClientVersion7() {
if
(
FFrameType
==
WEBSOCKET_FRAME_TEXT
)
{
for
(
var
i
=
0
;
i
<
InStr
.
length
;
i
++
)
{
InByte
=
InStr
.
charCodeAt
(
i
);
if
(
FFrameMasked
)
InByte
^=
FFrameMask
[
FFramePayloadReceived
++
%
4
];
if
(
FFrameMasked
)
{
InByte
^=
FFrameMask
[
FFrameMaskIndex
++
];
if
(
FFrameMaskIndex
>=
FFrameMask
.
length
)
FFrameMaskIndex
=
0
;
}
// Check if the byte needs to be UTF-8 decoded
if
((
InByte
&
0x80
)
===
0
)
{
...
...
@@ -356,7 +359,10 @@ function GetFromWebSocketClientVersion7() {
}
else
if
((
InByte
&
0xE0
)
===
0xC0
)
{
// Handle UTF-8 decode
InByte2
=
InStr
.
charCodeAt
(
++
i
);
if
(
FFrameMasked
)
InByte2
^=
FFrameMask
[
FFramePayloadReceived
++
%
4
];
if
(
FFrameMasked
)
{
InByte2
^=
FFrameMask
[
FFrameMaskIndex
++
];
if
(
FFrameMaskIndex
>=
FFrameMask
.
length
)
FFrameMaskIndex
=
0
;
}
Result
+=
String
.
fromCharCode
(((
InByte
&
31
)
<<
6
)
|
(
InByte2
&
63
));
}
else
{
throw
new
Error
(
'
GetFromWebSocketClientVersion7 Byte out of range:
'
+
InByte
);
...
...
@@ -365,7 +371,10 @@ function GetFromWebSocketClientVersion7() {
}
else
if
(
FFrameType
===
WEBSOCKET_FRAME_BINARY
)
{
for
(
var
i
=
0
;
i
<
InStr
.
length
;
i
++
)
{
InByte
=
InStr
.
charCodeAt
(
i
);
if
(
FFrameMasked
)
InByte
^=
FFrameMask
[
FFramePayloadReceived
++
%
4
];
if
(
FFrameMasked
)
{
InByte
^=
FFrameMask
[
FFrameMaskIndex
++
];
if
(
FFrameMaskIndex
>=
FFrameMask
.
length
)
FFrameMaskIndex
=
0
;
}
Result
+=
String
.
fromCharCode
(
InByte
);
}
}
else
{
...
...
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