mirror of
https://github.com/boostorg/mysql.git
synced 2026-02-16 01:22:20 +00:00
Updated docs on SSL
This commit is contained in:
3
TODO.txt
3
TODO.txt
@@ -1,6 +1,5 @@
|
||||
SSL
|
||||
Docs on SSL
|
||||
Update example docs on SSL
|
||||
SSL mode "enable" (not being required)
|
||||
Multiresultset
|
||||
Text protocol
|
||||
Binary protocol (stored procedures)
|
||||
|
||||
@@ -55,6 +55,9 @@ void main_impl(int argc, char** argv)
|
||||
argv[2], // password
|
||||
"mysql_asio_examples" // database to use; leave empty or omit the parameter for no database
|
||||
);
|
||||
// connection_params accepts an optional ssl_options argument describing
|
||||
// whether to use TLS on the connection or not. By default, TLS is enabled
|
||||
// and required.
|
||||
|
||||
boost::asio::io_context ctx;
|
||||
|
||||
|
||||
@@ -7,18 +7,30 @@
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
|
||||
/// Determines whether to use TLS for the connection or not.
|
||||
enum class ssl_mode
|
||||
{
|
||||
disable,
|
||||
require
|
||||
disable, ///< Never use TLS
|
||||
require ///< Always use TLS; abort the connection if the server does not support it.
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Connection options regarding TLS.
|
||||
* \details At the moment, contains only the \ref ssl_mode, which
|
||||
* indicates whether to use TLS on the connection or not.
|
||||
*/
|
||||
class ssl_options
|
||||
{
|
||||
ssl_mode mode_;
|
||||
public:
|
||||
/**
|
||||
* \brief Default and initialization constructor.
|
||||
* \details By default, SSL is required for the connection to be established.
|
||||
*/
|
||||
explicit ssl_options(ssl_mode mode=ssl_mode::require) noexcept:
|
||||
mode_(mode) {}
|
||||
|
||||
/// Retrieves the TLS mode to be used for the connection.
|
||||
ssl_mode mode() const noexcept { return mode_; }
|
||||
};
|
||||
|
||||
@@ -40,7 +52,7 @@ public:
|
||||
std::string_view password, ///< Password for that username, possibly empty.
|
||||
std::string_view db = "", ///< Database to use, or empty string for no database.
|
||||
collation connection_col = collation::utf8_general_ci, ///< The default character set and collation for the connection.
|
||||
const ssl_options& opts = ssl_options()
|
||||
const ssl_options& opts = ssl_options() ///< The TLS options to use with this connection.
|
||||
) :
|
||||
username_(username),
|
||||
password_(password),
|
||||
|
||||
Reference in New Issue
Block a user