Use QUrl with server details to build HTTP address used to compare MPD http file paths against.

This commit is contained in:
craig.p.drummond
2014-07-19 10:29:06 +00:00
committed by craig.p.drummond
parent 1681e5db32
commit 16777a3954
4 changed files with 21 additions and 3 deletions

View File

@@ -258,8 +258,9 @@ HttpSocket::HttpSocket(const QString &iface, quint16 port)
if (isListening() && ifaceAddress.isEmpty()) {
ifaceAddress=QLatin1String("127.0.0.1");
}
setUrlAddress();
DBUG << isListening() << ifaceAddress << serverPort();
DBUG << isListening() << urlAddr;
connect(MPDConnection::self(), SIGNAL(socketAddress(QString)), this, SLOT(mpdAddress(QString)));
connect(MPDConnection::self(), SIGNAL(cantataStreams(QList<Song>,bool)), this, SLOT(cantataStreams(QList<Song>,bool)));
@@ -565,3 +566,16 @@ bool HttpSocket::write(QTcpSocket *socket, char *buffer, qint32 bytesRead, bool
}
return true;
}
void HttpSocket::setUrlAddress()
{
if (ifaceAddress.isEmpty()) {
ifaceAddress=QString();
} else {
QUrl url;
url.setScheme("http");
url.setHost(ifaceAddress);
url.setPort(serverPort());
urlAddr=url.toString();
}
}