mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-13 12:52:27 +00:00
Fix discovery of IPv6-only hosts
This commit is contained in:
parent
d110bff253
commit
940da6bc73
3 changed files with 28 additions and 7 deletions
|
@ -629,12 +629,17 @@ private:
|
||||||
|
|
||||||
// Perform initial serverinfo fetch over HTTP since we don't know which cert to use
|
// Perform initial serverinfo fetch over HTTP since we don't know which cert to use
|
||||||
QString serverInfo = fetchServerInfo(http);
|
QString serverInfo = fetchServerInfo(http);
|
||||||
|
if (serverInfo.isEmpty() && !m_MdnsIpv6Address.isNull()) {
|
||||||
|
// Retry using the global IPv6 address if the IPv4 or link-local IPv6 address fails
|
||||||
|
http.setAddress(m_MdnsIpv6Address.toString());
|
||||||
|
serverInfo = fetchServerInfo(http);
|
||||||
|
}
|
||||||
if (serverInfo.isEmpty()) {
|
if (serverInfo.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create initial newComputer using HTTP serverinfo with no pinned cert
|
// Create initial newComputer using HTTP serverinfo with no pinned cert
|
||||||
NvComputer* newComputer = new NvComputer(m_Address, serverInfo, QSslCertificate());
|
NvComputer* newComputer = new NvComputer(http.address(), serverInfo, QSslCertificate());
|
||||||
|
|
||||||
// Check if we have a record of this host UUID to pull the pinned cert
|
// Check if we have a record of this host UUID to pull the pinned cert
|
||||||
NvComputer* existingComputer;
|
NvComputer* existingComputer;
|
||||||
|
@ -654,7 +659,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the polled computer with the HTTPS information
|
// Update the polled computer with the HTTPS information
|
||||||
NvComputer httpsComputer(m_Address, serverInfo, QSslCertificate());
|
NvComputer httpsComputer(http.address(), serverInfo, QSslCertificate());
|
||||||
newComputer->update(httpsComputer);
|
newComputer->update(httpsComputer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,18 +18,15 @@
|
||||||
#define QUIT_TIMEOUT_MS 30000
|
#define QUIT_TIMEOUT_MS 30000
|
||||||
|
|
||||||
NvHTTP::NvHTTP(QString address, QSslCertificate serverCert) :
|
NvHTTP::NvHTTP(QString address, QSslCertificate serverCert) :
|
||||||
m_Address(address),
|
|
||||||
m_ServerCert(serverCert)
|
m_ServerCert(serverCert)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!address.isEmpty());
|
|
||||||
|
|
||||||
m_BaseUrlHttp.setScheme("http");
|
m_BaseUrlHttp.setScheme("http");
|
||||||
m_BaseUrlHttps.setScheme("https");
|
m_BaseUrlHttps.setScheme("https");
|
||||||
m_BaseUrlHttp.setHost(address);
|
|
||||||
m_BaseUrlHttps.setHost(address);
|
|
||||||
m_BaseUrlHttp.setPort(47989);
|
m_BaseUrlHttp.setPort(47989);
|
||||||
m_BaseUrlHttps.setPort(47984);
|
m_BaseUrlHttps.setPort(47984);
|
||||||
|
|
||||||
|
setAddress(address);
|
||||||
|
|
||||||
// Never use a proxy server
|
// Never use a proxy server
|
||||||
QNetworkProxy noProxy(QNetworkProxy::NoProxy);
|
QNetworkProxy noProxy(QNetworkProxy::NoProxy);
|
||||||
m_Nam.setProxy(noProxy);
|
m_Nam.setProxy(noProxy);
|
||||||
|
@ -42,6 +39,21 @@ void NvHTTP::setServerCert(QSslCertificate serverCert)
|
||||||
m_ServerCert = serverCert;
|
m_ServerCert = serverCert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NvHTTP::setAddress(QString address)
|
||||||
|
{
|
||||||
|
Q_ASSERT(!address.isEmpty());
|
||||||
|
|
||||||
|
m_Address = address;
|
||||||
|
|
||||||
|
m_BaseUrlHttp.setHost(address);
|
||||||
|
m_BaseUrlHttps.setHost(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString NvHTTP::address()
|
||||||
|
{
|
||||||
|
return m_Address;
|
||||||
|
}
|
||||||
|
|
||||||
QVector<int>
|
QVector<int>
|
||||||
NvHTTP::parseQuad(QString quad)
|
NvHTTP::parseQuad(QString quad)
|
||||||
{
|
{
|
||||||
|
|
|
@ -156,6 +156,10 @@ public:
|
||||||
|
|
||||||
void setServerCert(QSslCertificate serverCert);
|
void setServerCert(QSslCertificate serverCert);
|
||||||
|
|
||||||
|
void setAddress(QString address);
|
||||||
|
|
||||||
|
QString address();
|
||||||
|
|
||||||
static
|
static
|
||||||
QVector<int>
|
QVector<int>
|
||||||
parseQuad(QString quad);
|
parseQuad(QString quad);
|
||||||
|
|
Loading…
Reference in a new issue