Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
2cbfa145
Commit
2cbfa145
authored
Aug 12, 2023
by
Samir Halilcevic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit tests for failing UTF-8
parent
1fe2518f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
2 deletions
+49
-2
libcaf_net/tests/legacy/net/web_socket/framing.cpp
libcaf_net/tests/legacy/net/web_socket/framing.cpp
+49
-2
No files found.
libcaf_net/tests/legacy/net/web_socket/framing.cpp
View file @
2cbfa145
...
...
@@ -350,7 +350,6 @@ SCENARIO("the application shuts down on invalid UTF-8 message") {
detail
::
rfc6455
::
assemble_frame
(
detail
::
rfc6455
::
continuation_frame
,
0x0
,
data_span
.
subspan
(
11
),
frame
);
transport
->
push
(
frame
);
THEN
(
"the server aborts the application"
)
{
CHECK_EQ
(
transport
->
handle_input
(),
0
);
CHECK_EQ
(
app
->
abort_reason
,
sec
::
malformed_message
);
...
...
@@ -359,7 +358,7 @@ SCENARIO("the application shuts down on invalid UTF-8 message") {
MESSAGE
(
"Aborted with: "
<<
app
->
abort_reason
);
}
}
WHEN
(
"the client sends the
first invalid byte
"
)
{
WHEN
(
"the client sends the
invalid byte on a frame boundary
"
)
{
reset
();
byte_buffer
frame
;
detail
::
rfc6455
::
assemble_frame
(
detail
::
rfc6455
::
text_frame
,
0x0
,
...
...
@@ -379,6 +378,54 @@ SCENARIO("the application shuts down on invalid UTF-8 message") {
MESSAGE
(
"Aborted with: "
<<
app
->
abort_reason
);
}
}
WHEN
(
"the client sends an invalid text frame byte by byte"
)
{
reset
();
byte_buffer
frame
;
detail
::
rfc6455
::
assemble_frame
(
detail
::
rfc6455
::
text_frame
,
0x0
,
data_span
,
frame
,
0
);
for
(
auto
i
=
0
;
i
<
14
;
i
++
)
{
transport
->
push
(
make_span
(
frame
).
subspan
(
i
,
1
));
CHECK_EQ
(
transport
->
handle_input
(),
0
);
CHECK
(
!
app
->
has_aborted
());
}
THEN
(
"the server aborts when receiving the invalid byte"
)
{
transport
->
push
(
make_span
(
frame
).
subspan
(
14
,
1
));
CHECK_EQ
(
transport
->
handle_input
(),
0
);
CHECK_EQ
(
app
->
abort_reason
,
sec
::
malformed_message
);
CHECK_EQ
(
fetch_status
(
transport
->
output_buffer
()),
static_cast
<
int
>
(
net
::
web_socket
::
status
::
inconsistent_data
));
MESSAGE
(
"Aborted with: "
<<
app
->
abort_reason
);
}
WHEN
(
"the client sends the first frame of a text messagee"
)
{
reset
();
byte_buffer
frame
;
detail
::
rfc6455
::
assemble_frame
(
detail
::
rfc6455
::
text_frame
,
0x0
,
data_span
.
subspan
(
0
,
6
),
frame
,
0
);
transport
->
push
(
frame
);
CHECK_EQ
(
transport
->
handle_input
(),
static_cast
<
ptrdiff_t
>
(
frame
.
size
()));
CHECK
(
!
app
->
has_aborted
());
}
AND_WHEN
(
"sending the invalid continuation frame byte by byte"
)
{
byte_buffer
frame
;
detail
::
rfc6455
::
assemble_frame
(
detail
::
rfc6455
::
continuation_frame
,
0x0
,
data_span
.
subspan
(
6
),
frame
);
for
(
auto
i
=
0
;
i
<
8
;
i
++
)
{
transport
->
push
(
make_span
(
frame
).
subspan
(
i
,
1
));
CHECK_EQ
(
transport
->
handle_input
(),
0
);
CHECK
(
!
app
->
has_aborted
());
}
THEN
(
"the server aborts the application on the invalid byte"
)
{
transport
->
push
(
make_span
(
frame
).
subspan
(
8
,
1
));
CHECK_EQ
(
transport
->
handle_input
(),
0
);
CHECK_EQ
(
app
->
abort_reason
,
sec
::
malformed_message
);
CHECK_EQ
(
fetch_status
(
transport
->
output_buffer
()),
static_cast
<
int
>
(
net
::
web_socket
::
status
::
inconsistent_data
));
MESSAGE
(
"Aborted with: "
<<
app
->
abort_reason
);
}
}
}
}
}
...
...
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