mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 19:30:21 +02:00
Update qxt to latest upstream git revision
Now we are using plain qxt again as all needed local modifications are merged upstream.
This commit is contained in:
@@ -65,6 +65,7 @@ public:
|
|||||||
QSslCertificate localCertificate;
|
QSslCertificate localCertificate;
|
||||||
QSslKey privateKey;
|
QSslKey privateKey;
|
||||||
bool autoEncrypt;
|
bool autoEncrypt;
|
||||||
|
QSsl::SslProtocol proto;
|
||||||
QQueue<QSslSocket*> pendingConnections;
|
QQueue<QSslSocket*> pendingConnections;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -75,6 +76,7 @@ QxtSslServer::QxtSslServer(QObject* parent) : QTcpServer(parent)
|
|||||||
{
|
{
|
||||||
QXT_INIT_PRIVATE(QxtSslServer);
|
QXT_INIT_PRIVATE(QxtSslServer);
|
||||||
qxt_d().autoEncrypt = true;
|
qxt_d().autoEncrypt = true;
|
||||||
|
qxt_d().proto = QSsl::TlsV1SslV3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -194,16 +196,34 @@ bool QxtSslServer::autoEncrypt() const
|
|||||||
return qxt_d().autoEncrypt;
|
return qxt_d().autoEncrypt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Sets the protocol used when \a autoEncrypt is enabled.
|
||||||
|
*
|
||||||
|
* \sa protocol
|
||||||
|
*/
|
||||||
|
void QxtSslServer::setProtocol(QSsl::SslProtocol proto)
|
||||||
|
{
|
||||||
|
qxt_d().proto = proto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns the protocol used when \a autoEncrypt is enabled.
|
||||||
|
* \sa setProtocol
|
||||||
|
*/
|
||||||
|
QSsl::SslProtocol QxtSslServer::protocol() const
|
||||||
|
{
|
||||||
|
return qxt_d().proto;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \reimp
|
* \reimp
|
||||||
*/
|
*/
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
#if QT_VERSION >= 0x050000
|
||||||
void QxtSslServer::incomingConnection(qintptr socketDescriptor)
|
void QxtSslServer::incomingConnection(qintptr socketDescriptor)
|
||||||
#else
|
#else
|
||||||
void QxtSslServer::incomingConnection(int socketDescriptor)
|
void QxtSslServer::incomingConnection(int socketDescriptor)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
qWarning() << Q_FUNC_INFO << socketDescriptor;
|
|
||||||
QSslSocket* socket = new QSslSocket(this);
|
QSslSocket* socket = new QSslSocket(this);
|
||||||
if(socket->setSocketDescriptor(socketDescriptor)) {
|
if(socket->setSocketDescriptor(socketDescriptor)) {
|
||||||
socket->setLocalCertificate(qxt_d().localCertificate);
|
socket->setLocalCertificate(qxt_d().localCertificate);
|
||||||
|
@@ -60,9 +60,12 @@ public:
|
|||||||
void setAutoEncrypt(bool on);
|
void setAutoEncrypt(bool on);
|
||||||
bool autoEncrypt() const;
|
bool autoEncrypt() const;
|
||||||
|
|
||||||
|
void setProtocol(QSsl::SslProtocol proto);
|
||||||
|
QSsl::SslProtocol protocol() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
#if QT_VERSION >= 0x050000
|
||||||
virtual void incomingConnection(qintptr socketDescriptor);
|
virtual void incomingConnection(qintptr socketDescriptor);
|
||||||
#else
|
#else
|
||||||
virtual void incomingConnection(int socketDescriptor);
|
virtual void incomingConnection(int socketDescriptor);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -131,7 +131,9 @@ bool QxtScgiServerConnector::canParseRequest(const QByteArray& buffer)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (buffer.size() > expectedsize.toInt());
|
// The SCGI header is [len]":"[key/value pairs]","
|
||||||
|
int headersize = expectedsize.count() + expectedsize.toInt() + 2;
|
||||||
|
return (buffer.size() >= headersize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -159,25 +161,26 @@ QHttpRequestHeader QxtScgiServerConnector::parseRequest(QByteArray& buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buffer = buffer.right(buffer.size() - (expectedsize_s.count() + 1));
|
int expectedsize = expectedsize_s.toInt();
|
||||||
|
QByteArray requestheaders = buffer.mid(expectedsize_s.count() + 1, expectedsize);
|
||||||
|
buffer = buffer.mid(expectedsize_s.count() + expectedsize + 2);
|
||||||
|
|
||||||
QHttpRequestHeader request_m;
|
QHttpRequestHeader request_m;
|
||||||
|
|
||||||
QByteArray name;
|
QByteArray name;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while ((i = buffer.indexOf('\0')) > -1)
|
while ((i = requestheaders.indexOf('\0')) > -1)
|
||||||
{
|
{
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
{
|
{
|
||||||
name = buffer.left(i);
|
name = requestheaders.left(i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
request_m.setValue(QString::fromLatin1(name).toLower(), QString::fromLatin1(buffer.left(i)));
|
request_m.setValue(QString::fromLatin1(name).toLower(), QString::fromLatin1(requestheaders.left(i)));
|
||||||
name = "";
|
name = "";
|
||||||
}
|
}
|
||||||
buffer = buffer.mid(i + 1);
|
requestheaders = requestheaders.mid(i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -188,16 +191,13 @@ QHttpRequestHeader QxtScgiServerConnector::parseRequest(QByteArray& buffer)
|
|||||||
{
|
{
|
||||||
if (key.startsWith(QString("http_")))
|
if (key.startsWith(QString("http_")))
|
||||||
{
|
{
|
||||||
request_m.setValue(key.right(key.size() - 5), request_m.value(key));
|
QString realKey = key.right(key.size() - 5).replace(QLatin1Char('_'), QLatin1Char('-'));
|
||||||
|
request_m.setValue(realKey, request_m.value(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
request_m.setValue("Connection", "close");
|
request_m.setValue("Connection", "close");
|
||||||
|
|
||||||
|
|
||||||
buffer.chop(1);
|
|
||||||
|
|
||||||
|
|
||||||
return request_m;
|
return request_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user