diff options
author | Alexander Blair <snipa@jagtech.io> | 2020-12-10 17:34:50 -0800 |
---|---|---|
committer | Alexander Blair <snipa@jagtech.io> | 2020-12-10 17:34:50 -0800 |
commit | 1e9483a2d585d4ce4c2bf001862132ca46185c16 (patch) | |
tree | b9a58d5cd7de6b8ed5da9df1c869449f0623611b /contrib/epee/include/storages/http_abstract_invoke.h | |
parent | Merge pull request #7003 (diff) | |
parent | Change epee binary output from std::stringstream to byte_stream (diff) | |
download | monero-1e9483a2d585d4ce4c2bf001862132ca46185c16.tar.xz |
Merge pull request #7009
7414e2bac Change epee binary output from std::stringstream to byte_stream (Lee Clagett)
Diffstat (limited to 'contrib/epee/include/storages/http_abstract_invoke.h')
-rw-r--r-- | contrib/epee/include/storages/http_abstract_invoke.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/epee/include/storages/http_abstract_invoke.h b/contrib/epee/include/storages/http_abstract_invoke.h index a8bc945a8..c4cb91130 100644 --- a/contrib/epee/include/storages/http_abstract_invoke.h +++ b/contrib/epee/include/storages/http_abstract_invoke.h @@ -29,6 +29,7 @@ #include <boost/utility/string_ref.hpp> #include <chrono> #include <string> +#include "byte_slice.h" #include "portable_storage_template_helper.h" #include "net/http_base.h" #include "net/http_server_handlers_map2.h" @@ -74,12 +75,12 @@ namespace epee template<class t_request, class t_response, class t_transport> bool invoke_http_bin(const boost::string_ref uri, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref method = "POST") { - std::string req_param; - if(!serialization::store_t_to_binary(out_struct, req_param)) + byte_slice req_param; + if(!serialization::store_t_to_binary(out_struct, req_param, 16 * 1024)) return false; const http::http_response_info* pri = NULL; - if(!transport.invoke(uri, method, req_param, timeout, std::addressof(pri))) + if(!transport.invoke(uri, method, boost::string_ref{reinterpret_cast<const char*>(req_param.data()), req_param.size()}, timeout, std::addressof(pri))) { LOG_PRINT_L1("Failed to invoke http request to " << uri); return false; |