prefer ssl connections rather than plaintext ones in upnp discovery response
This commit is contained in:
parent
651e0bd3d8
commit
cb4908dc92
@ -576,8 +576,13 @@ QByteArray WebServer::createServerXmlDocument(QHostAddress address)
|
|||||||
bool webSocketServerFound = false;
|
bool webSocketServerFound = false;
|
||||||
foreach (const ServerConfiguration &config, GuhCore::instance()->configuration()->webSocketServerConfigurations()) {
|
foreach (const ServerConfiguration &config, GuhCore::instance()->configuration()->webSocketServerConfigurations()) {
|
||||||
if (config.address == QHostAddress("0.0.0.0") || config.address == address) {
|
if (config.address == QHostAddress("0.0.0.0") || config.address == address) {
|
||||||
websocketConfiguration = config;
|
if (!webSocketServerFound) {
|
||||||
webSocketServerFound = true;
|
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) {
|
if (webSocketServerFound) {
|
||||||
@ -592,8 +597,13 @@ QByteArray WebServer::createServerXmlDocument(QHostAddress address)
|
|||||||
bool tcpServerFound = false;
|
bool tcpServerFound = false;
|
||||||
foreach (const ServerConfiguration &config, GuhCore::instance()->configuration()->tcpServerConfigurations()) {
|
foreach (const ServerConfiguration &config, GuhCore::instance()->configuration()->tcpServerConfigurations()) {
|
||||||
if (config.address == QHostAddress("0.0.0.0") || config.address == address) {
|
if (config.address == QHostAddress("0.0.0.0") || config.address == address) {
|
||||||
tcpServerConfiguration = config;
|
if (!tcpServerFound) {
|
||||||
tcpServerFound = true;
|
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) {
|
if (tcpServerFound) {
|
||||||
|
|||||||
Reference in New Issue
Block a user