Changes ssl to tls

This commit is contained in:
2025-11-03 02:46:04 -05:00
parent 05d4908906
commit 1c6597895c
3 changed files with 11 additions and 11 deletions

View File

@@ -88,16 +88,16 @@ class IDHANClient
* @param client_name Name of the client that shows up in the server logs for network logs and in the logging statements
* @param hostname
* @param port
* @param use_ssl
* @param use_tls
*/
IDHANClient( const QString& client_name, const QString& hostname, qint16 port, bool use_ssl = false );
IDHANClient( const QString& client_name, const QString& hostname, qint16 port, bool use_tls = false );
~IDHANClient();
//! Returns true if the server responds (sends back valid version info)
bool validConnection() const;
void openConnection( QString hostname, qint16 port, bool use_ssl = false );
void openConnection( QString hostname, qint16 port, bool use_tls = false );
QFuture< std::vector< RecordID > > createRecords( std::vector< std::array< std::byte, 32 > >& hashes );

View File

@@ -101,7 +101,7 @@ IDHANClient& IDHANClient::instance()
return *m_instance;
}
IDHANClient::IDHANClient( const QString& client_name, const QString& hostname, const qint16 port, const bool use_ssl ) :
IDHANClient::IDHANClient( const QString& client_name, const QString& hostname, const qint16 port, const bool use_tls ) :
m_logger( spdlog::stdout_color_mt( client_name.toStdString() ) ),
network( nullptr )
{
@@ -121,7 +121,7 @@ IDHANClient::IDHANClient( const QString& client_name, const QString& hostname, c
throw std::runtime_error(
"IDHANClient expects a Qt instance. Please use QGuiApplication of QApplication before constructing IDHANClient" );
openConnection( hostname, port, use_ssl );
openConnection( hostname, port, use_tls );
}
void IDHANClient::sendClientGet(
@@ -318,14 +318,14 @@ bool IDHANClient::validConnection() const
return future.resultCount() > 0;
}
void IDHANClient::openConnection( const QString hostname, const qint16 port, const bool use_ssl )
void IDHANClient::openConnection( const QString hostname, const qint16 port, const bool use_tls )
{
if ( hostname.isEmpty() ) throw std::runtime_error( "hostname must not be empty" );
m_url_template.setHost( hostname );
m_url_template.setPort( port );
m_url_template.setScheme( use_ssl ? "https" : "http" );
m_url_template.setScheme( use_tls ? "https" : "http" );
}
} // namespace idhan

View File

@@ -159,21 +159,21 @@ ServerContext::ServerContext( const ConnectionArguments& arguments ) :
app.setFileTypes( { "html", "wasm", "svg", "js", "png", "jpg" } );
const bool use_ssl { config::get< bool >( "host", "use_ssl", true ) };
const bool use_tls { config::get< bool >( "host", "use_tls", true ) };
const auto ipv4_listener { config::get< std::string >( "host", "ipv4_listen", "127.0.0.1" ) };
const auto ipv6_listener { config::get< std::string >( "host", "ipv6_listen", "::1" ) };
if ( use_ssl )
if ( use_tls )
{
const auto server_cert_path { config::get< std::string >( "host", "server_cert_path", "./server.crt" ) };
const auto server_key_path { config::get< std::string >( "host", "server_key_path", "./server.key" ) };
if ( !ipv4_listener.empty() )
app.addListener( ipv4_listener, IDHAN_DEFAULT_PORT, use_ssl, server_cert_path, server_key_path );
app.addListener( ipv4_listener, IDHAN_DEFAULT_PORT, use_tls, server_cert_path, server_key_path );
if ( !ipv6_listener.empty() )
app.addListener( ipv6_listener, IDHAN_DEFAULT_PORT, use_ssl, server_cert_path, server_key_path );
app.addListener( ipv6_listener, IDHAN_DEFAULT_PORT, use_tls, server_cert_path, server_key_path );
}
drogon::orm::PostgresConfig config {};