aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/net/http_client.h
diff options
context:
space:
mode:
authorJaquee <jaquee.monero@gmail.com>2017-06-20 17:22:24 +0200
committerJaquee <jaquee.monero@gmail.com>2017-10-15 17:29:04 +0200
commit1cf940f2a1292c3ebfd57709782bb53b92803aaa (patch)
tree2c785ac703fd4ac879871d84407f86310e813327 /contrib/epee/include/net/http_client.h
parentCMakeLists.txt - Add openssl include dir (diff)
downloadmonero-1cf940f2a1292c3ebfd57709782bb53b92803aaa.tar.xz
epee http_client SSL support
Diffstat (limited to 'contrib/epee/include/net/http_client.h')
-rw-r--r--contrib/epee/include/net/http_client.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/epee/include/net/http_client.h b/contrib/epee/include/net/http_client.h
index 8e099e2bc..ed89ca0c7 100644
--- a/contrib/epee/include/net/http_client.h
+++ b/contrib/epee/include/net/http_client.h
@@ -274,6 +274,7 @@ using namespace std;
chunked_state m_chunked_state;
std::string m_chunked_cache;
critical_section m_lock;
+ bool m_ssl;
public:
explicit http_simple_client()
@@ -291,33 +292,35 @@ using namespace std;
, m_chunked_state()
, m_chunked_cache()
, m_lock()
+ , m_ssl(false)
{}
const std::string &get_host() const { return m_host_buff; };
const std::string &get_port() const { return m_port; };
- bool set_server(const std::string& address, boost::optional<login> user)
+ bool set_server(const std::string& address, boost::optional<login> user, bool ssl = false)
{
http::url_content parsed{};
const bool r = parse_url(address, parsed);
CHECK_AND_ASSERT_MES(r, false, "failed to parse url: " << address);
- set_server(std::move(parsed.host), std::to_string(parsed.port), std::move(user));
+ set_server(std::move(parsed.host), std::to_string(parsed.port), std::move(user), ssl);
return true;
}
- void set_server(std::string host, std::string port, boost::optional<login> user)
+ void set_server(std::string host, std::string port, boost::optional<login> user, bool ssl = false)
{
CRITICAL_REGION_LOCAL(m_lock);
disconnect();
m_host_buff = std::move(host);
m_port = std::move(port);
m_auth = user ? http_client_auth{std::move(*user)} : http_client_auth{};
+ m_ssl = ssl;
}
bool connect(std::chrono::milliseconds timeout)
{
CRITICAL_REGION_LOCAL(m_lock);
- return m_net_client.connect(m_host_buff, m_port, timeout);
+ return m_net_client.connect(m_host_buff, m_port, timeout, m_ssl);
}
//---------------------------------------------------------------------------
bool disconnect()
@@ -392,7 +395,6 @@ using namespace std;
res = m_net_client.send(body, timeout);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
-
m_response_info.clear();
m_state = reciev_machine_state_header;
if (!handle_reciev(timeout))