prefer ssl connections rather than plaintext ones in upnp discovery response

This commit is contained in:
Michael Zanetti 2017-09-15 23:30:22 +02:00
parent 651e0bd3d8
commit cb4908dc92

View File

@ -576,8 +576,13 @@ QByteArray WebServer::createServerXmlDocument(QHostAddress address)
bool webSocketServerFound = false;
foreach (const ServerConfiguration &config, GuhCore::instance()->configuration()->webSocketServerConfigurations()) {
if (config.address == QHostAddress("0.0.0.0") || config.address == address) {
websocketConfiguration = config;
webSocketServerFound = true;
if (!webSocketServerFound) {
websocketConfiguration = config;
webSocketServerFound = true;
} else if (!websocketConfiguration.sslEnabled && config.sslEnabled) {
// If the previous one is plaintext but we also have a secure one, upgrade to that.
websocketConfiguration = config;
}
}
}
if (webSocketServerFound) {
@ -592,8 +597,13 @@ QByteArray WebServer::createServerXmlDocument(QHostAddress address)
bool tcpServerFound = false;
foreach (const ServerConfiguration &config, GuhCore::instance()->configuration()->tcpServerConfigurations()) {
if (config.address == QHostAddress("0.0.0.0") || config.address == address) {
tcpServerConfiguration = config;
tcpServerFound = true;
if (!tcpServerFound) {
tcpServerConfiguration = config;
tcpServerFound = true;
} else if (!tcpServerConfiguration.sslEnabled && config.sslEnabled) {
// If the previous one is plaintext but we also have a secure one, upgrade to that.
tcpServerConfiguration = config;
}
}
}
if (tcpServerFound) {