Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
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
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
Libraries
pistache
Commits
ede8503c
Commit
ede8503c
authored
Jan 07, 2022
by
Brian Keane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for issue #1007
parent
d1d23400
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
tests/streaming_test.cc
tests/streaming_test.cc
+43
-0
version.txt
version.txt
+1
-1
No files found.
tests/streaming_test.cc
View file @
ede8503c
...
...
@@ -267,3 +267,46 @@ TEST_F(StreamingTests, ChunkedStream)
EXPECT_EQ
(
chunks
[
1
],
"world"
);
EXPECT_EQ
(
chunks
[
2
],
"!"
);
}
TEST_F
(
StreamingTests
,
ChunkedStreamDisconnect
)
{
SyncContext
ctx
;
// force unbuffered
curl_easy_setopt
(
curl
,
CURLOPT_BUFFERSIZE
,
1
);
Init
(
std
::
make_shared
<
HelloHandler
>
(
ctx
));
std
::
thread
thread
([
&
]()
{
CURLM
*
multi_handle
;
int
still_running
=
1
;
multi_handle
=
curl_multi_init
();
curl_multi_add_handle
(
multi_handle
,
curl
);
// This sequence of _perform, _poll, _perform starts a requests (all 3 are needed)
curl_multi_perform
(
multi_handle
,
&
still_running
);
if
(
still_running
){
curl_multi_poll
(
multi_handle
,
NULL
,
0
,
1000
,
NULL
);
curl_multi_perform
(
multi_handle
,
&
still_running
);
}
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
200
));
// Hard-close the client request & socket before server is done responding
curl_multi_cleanup
(
multi_handle
);
});
std
::
unique_lock
<
std
::
mutex
>
lk
{
ctx
.
m
};
ctx
.
cv
.
wait
(
lk
,
[
&
ctx
]
{
return
ctx
.
flag
;
});
//Bad behavior might take a few seconds...
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
2000
));
if
(
thread
.
joinable
())
{
thread
.
join
();
}
// Don't care about response content, this test will fail if SIGINT is raised
}
\ No newline at end of file
version.txt
View file @
ede8503c
0.0.3.202
11030
0.0.3.202
20107
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