Reputation: 21
I have dabbled with the c++ rest sdk for a while now and got around making a server and client fully.
The problem is that http requests from the client to the server seem to always be plaintext so when i want to try logging in,
the URI is http://... [email protected]&password=123456 I am new to network programming but this doesn't seem very secure and from what i understand https is the way to go... so far no info though as to how to setup a http over SSL server with casablanca c++ rest sdk.
Has anyone here tried to do this? maybe i need an additional library for this specifically?
Upvotes: 2
Views: 5926
Reputation: 471
casablanca support HTTPS on the client side with http_client on ALL platforms, it is only with the http_listener that HTTPS works on Windows only. To use https simply specify the scheme of the URI when constructing the http_client or http_listener object to be https, for example 'https://www.google.com'. and add ssl certificate to listening port.
Upvotes: 2
Reputation: 358
This is what I see in the http_listener code. It doesn't appear to support Windows at all.
#ifndef _WIN32
/// <summary>
/// Get the callback of ssl context
/// </summary>
/// <returns>The function defined by the user of http_listener_config to configure a ssl context.</returns>
const std::function<void(boost::asio::ssl::context&)>& get_ssl_context_callback() const
{
return m_ssl_context_callback;
}
/// <summary>
/// Set the callback of ssl context
/// </summary>
/// <param name="ssl_context_callback">The function to configure a ssl context which will setup https connections.</param>
void set_ssl_context_callback(const std::function<void(boost::asio::ssl::context&)> &ssl_context_callback)
{
m_ssl_context_callback = ssl_context_callback;
}
#endif
Upvotes: 1