@@ -717,6 +717,13 @@ class Result {
717717 Error err_;
718718};
719719
720+ struct ClientOptions {
721+ Headers headers;
722+ Progress progress;
723+ ResponseHandler response_handler;
724+ ContentReceiver content_receiver;
725+ };
726+
720727class ClientImpl {
721728public:
722729 explicit ClientImpl (const std::string &host);
@@ -731,6 +738,8 @@ class ClientImpl {
731738
732739 virtual bool is_valid () const ;
733740
741+ Result Get2 (std::string_view path, ClientOptions options);
742+
734743 Result Get (const char *path);
735744 Result Get (const char *path, const Headers &headers);
736745 Result Get (const char *path, Progress progress);
@@ -966,6 +975,8 @@ class Client {
966975
967976 bool is_valid () const ;
968977
978+ Result Get2 (std::string_view path, ClientOptions options);
979+
969980 Result Get (const char *path);
970981 Result Get (const char *path, const Headers &headers);
971982 Result Get (const char *path, Progress progress);
@@ -5106,6 +5117,13 @@ ClientImpl::process_socket(Socket &socket,
51065117
51075118inline bool ClientImpl::is_ssl () const { return false ; }
51085119
5120+ inline Result ClientImpl::Get2 (std::string_view path, ClientOptions options) {
5121+ auto path2 = std::string (path);
5122+ return Get (path2.c_str (), std::move (options.headers ),
5123+ std::move (options.response_handler ),
5124+ std::move (options.content_receiver ), std::move (options.progress ));
5125+ }
5126+
51095127inline Result ClientImpl::Get (const char *path) {
51105128 return Get (path, Headers (), Progress ());
51115129}
@@ -5844,7 +5862,7 @@ inline void SSLClient::set_ca_cert_path(const char *ca_cert_file_path,
58445862
58455863inline void SSLClient::set_ca_cert_store (X509_STORE *ca_cert_store) {
58465864 if (ca_cert_store) {
5847- if (ctx_) {
5865+ if (ctx_) {
58485866 if (SSL_CTX_get_cert_store (ctx_) != ca_cert_store) {
58495867 // Free memory allocated for old cert and use new store `ca_cert_store`
58505868 SSL_CTX_set_cert_store (ctx_, ca_cert_store);
@@ -6205,6 +6223,10 @@ inline bool Client::is_valid() const {
62056223 return cli_ != nullptr && cli_->is_valid ();
62066224}
62076225
6226+ inline Result Client::Get2 (std::string_view path, ClientOptions options) {
6227+ return cli_->Get2 (path, options);
6228+ }
6229+
62086230inline Result Client::Get (const char *path) { return cli_->Get (path); }
62096231inline Result Client::Get (const char *path, const Headers &headers) {
62106232 return cli_->Get (path, headers);
0 commit comments