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
97df09b9
Commit
97df09b9
authored
Jun 07, 2010
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Output count for multi-packet decodes.
parent
9a09b636
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
websocket.c
utils/websocket.c
+7
-5
No files found.
utils/websocket.c
View file @
97df09b9
...
@@ -195,8 +195,8 @@ int encode(u_char const *src, size_t srclength, char *target, size_t targsize) {
...
@@ -195,8 +195,8 @@ int encode(u_char const *src, size_t srclength, char *target, size_t targsize) {
}
}
int
decode
(
char
*
src
,
size_t
srclength
,
u_char
*
target
,
size_t
targsize
)
{
int
decode
(
char
*
src
,
size_t
srclength
,
u_char
*
target
,
size_t
targsize
)
{
char
*
start
,
*
end
;
char
*
start
,
*
end
,
cntstr
[
4
]
;
int
i
,
len
,
retlen
=
0
;
int
i
,
len
,
framecount
=
0
,
retlen
=
0
;
unsigned
char
chr
;
unsigned
char
chr
;
if
((
src
[
0
]
!=
'\x00'
)
||
(
src
[
srclength
-
1
]
!=
'\xff'
))
{
if
((
src
[
0
]
!=
'\x00'
)
||
(
src
[
srclength
-
1
]
!=
'\xff'
))
{
fprintf
(
stderr
,
"WebSocket framing error
\n
"
);
fprintf
(
stderr
,
"WebSocket framing error
\n
"
);
...
@@ -206,9 +206,6 @@ int decode(char *src, size_t srclength, u_char *target, size_t targsize) {
...
@@ -206,9 +206,6 @@ int decode(char *src, size_t srclength, u_char *target, size_t targsize) {
do
{
do
{
/* We may have more than one frame */
/* We may have more than one frame */
end
=
memchr
(
start
,
'\xff'
,
srclength
);
end
=
memchr
(
start
,
'\xff'
,
srclength
);
if
(
end
<
(
src
+
srclength
-
1
))
{
printf
(
"More than one frame to decode: %p < %p
\n
"
,
end
,
src
+
srclength
-
1
);
}
*
end
=
'\x00'
;
*
end
=
'\x00'
;
if
(
client_settings
.
do_b64encode
)
{
if
(
client_settings
.
do_b64encode
)
{
len
=
__b64_pton
(
start
,
target
+
retlen
,
targsize
-
retlen
);
len
=
__b64_pton
(
start
,
target
+
retlen
,
targsize
-
retlen
);
...
@@ -238,7 +235,12 @@ int decode(char *src, size_t srclength, u_char *target, size_t targsize) {
...
@@ -238,7 +235,12 @@ int decode(char *src, size_t srclength, u_char *target, size_t targsize) {
}
}
}
}
start
=
end
+
2
;
// Skip '\xff' end and '\x00' start
start
=
end
+
2
;
// Skip '\xff' end and '\x00' start
framecount
++
;
}
while
(
end
<
(
src
+
srclength
-
1
));
}
while
(
end
<
(
src
+
srclength
-
1
));
if
(
framecount
>
1
)
{
snprintf
(
cntstr
,
3
,
"%d"
,
framecount
);
traffic
(
cntstr
);
}
return
retlen
;
return
retlen
;
}
}
...
...
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