File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
include/ylt/standalone/cinatra Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -294,7 +294,12 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
294
294
bool no_schema = !has_schema (uri);
295
295
std::string append_uri;
296
296
if (no_schema) {
297
- append_uri.append (" http://" ).append (uri);
297
+ #ifdef CINATRA_ENABLE_SSL
298
+ if (is_ssl_schema_)
299
+ append_uri.append (" https://" ).append (uri);
300
+ else
301
+ #endif
302
+ append_uri.append (" http://" ).append (uri);
298
303
}
299
304
300
305
auto [ok, u] = handle_uri (data, no_schema ? append_uri : uri);
Original file line number Diff line number Diff line change @@ -424,6 +424,17 @@ async_simple::coro::Lazy<void> basic_usage() {
424
424
co_await client3.connect (" https://www.baidu.com" );
425
425
result = co_await client3.async_get (" /" );
426
426
assert (result.status == 200 );
427
+
428
+ coro_http_client client4{};
429
+ client4.set_ssl_schema (true );
430
+ result = client4.get (" www.baidu.com" );
431
+ assert (result.status == 200 );
432
+
433
+ coro_http_client client5{};
434
+ client5.set_ssl_schema (true );
435
+ co_await client5.connect (" www.baidu.com" );
436
+ result = co_await client5.async_get (" /" );
437
+ assert (result.status == 200 );
427
438
#endif
428
439
}
429
440
You can’t perform that action at this time.
0 commit comments