Add default port selection

This commit is contained in:
Lee *!* Clagett
2025-10-01 13:33:40 -04:00
parent a61db2e545
commit 2b7ed217c9
2 changed files with 16 additions and 4 deletions
+7
View File
@@ -807,6 +807,13 @@ namespace lwsf { namespace internal
epee::net_utils::ssl_support_t::e_ssl_support_enabled
};
if (!url.port)
{
if ((use_ssl || https))
url.port = 443;
else
url.port = 80;
}
data_->client.set_server(std::move(url.host), std::to_string(url.port), std::move(login), std::move(options));
}
catch (const std::exception& e)
+9 -4
View File
@@ -398,14 +398,19 @@ namespace lwsf
if (!url.m_uri_content.m_path.empty())
throw std::runtime_error{"LWS URL contains path (unsupported)"};
bool use_ssl = false;
if (url.schema == "https")
use_ssl = true;
const bool use_ssl = (url.schema == "https");
epee::net_utils::ssl_options_t options{
use_ssl ? epee::net_utils::ssl_support_t::e_ssl_support_enabled : epee::net_utils::ssl_support_t::e_ssl_support_disabled
};
if (!url.port)
{
if (use_ssl)
url.port = 443;
else
url.port = 80;
}
client_.set_server(std::move(url.host), std::to_string(url.port), boost::none, std::move(options));
}