File tree 2 files changed +13
-2
lines changed
include/ylt/standalone/cinatra
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -667,8 +667,9 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
667
667
bool is_body_in_out_buf () const { return !out_buf_.empty (); }
668
668
669
669
void reset () {
670
- if (!has_closed ())
670
+ if (!has_closed ()) {
671
671
close_socket (*socket_);
672
+ }
672
673
673
674
socket_->impl_ = asio::ip::tcp::socket{executor_wrapper_.context ()};
674
675
if (!socket_->impl_ .is_open ()) {
@@ -689,6 +690,7 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
689
690
socket_->ssl_stream_ =
690
691
std::make_unique<asio::ssl::stream<asio::ip::tcp::socket &>>(
691
692
socket_->impl_ , *ssl_ctx_);
693
+ has_init_ssl_ = false ;
692
694
}
693
695
#endif
694
696
#ifdef BENCHMARK_TEST
Original file line number Diff line number Diff line change @@ -251,7 +251,16 @@ TEST_CASE("test ssl client") {
251
251
auto result = client.get (" https://www.bing.com" );
252
252
CHECK (result.status >= 200 );
253
253
}
254
-
254
+ {
255
+ coro_http_client client{};
256
+ auto ret = client.get (" https://baidu.com" );
257
+ client.reset ();
258
+ ret = client.get (" http://cn.bing.com" );
259
+ std::cout << ret.status << std::endl;
260
+ client.reset ();
261
+ ret = client.get (" https://baidu.com" );
262
+ std::cout << ret.status << std::endl;
263
+ }
255
264
{
256
265
coro_http_client client{};
257
266
auto r =
You can’t perform that action at this time.
0 commit comments