This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2goclient. from d023964 Switch to QNetworkAccessManager. new 1bd4901 Revert "Switch to QNetworkAccessManager." new 19fe787 Switch to QNetworkAccessManager. Appropriately set content type header to "application/x-www-form-urlencoded" for HTTP post requests. (Fixes: #440, #138). The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit 19fe7875e2b8203780340272dc83189e9b8e470c Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Mar 3 11:55:44 2014 +0100 Switch to QNetworkAccessManager. Appropriately set content type header to "application/x-www-form-urlencoded" for HTTP post requests. (Fixes: #440, #138). --- debian/changelog | 6 +++ httpbrokerclient.cpp | 113 +++++++++++++++++++++++++------------------------- httpbrokerclient.h | 23 +++++----- 3 files changed, 76 insertions(+), 66 deletions(-) diff --git a/debian/changelog b/debian/changelog index 42c5799..daec032 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,12 @@ x2goclient (4.0.2.0-0x2go1) UNRELEASED; urgency=low from terminal on linux and mac. - If no user in session config, display system username in pass form. + [ Josh Lukens ] + * New upstream version (4.0.2.0): + - Switch to QNetworkAccessManager. Appropriately set content type + header to "application/x-www-form-urlencoded" for HTTP post + requests. (Fixes: #440, #138). + [ Mike Gabriel ] * debian/control: + Build-depend on libssh-dev (>= 0.5.4-2). diff --git a/httpbrokerclient.cpp b/httpbrokerclient.cpp index 4ca8e5d..fca59b4 100644 --- a/httpbrokerclient.cpp +++ b/httpbrokerclient.cpp @@ -16,8 +16,11 @@ ***************************************************************************/ #include "httpbrokerclient.h" +#include <QNetworkAccessManager> #include <QUrl> -#include <QHttp> +#include <QNetworkRequest> +#include <QNetworkReply> +#include <QUuid> #include <QTextStream> #include <QFile> #include <QDir> @@ -34,6 +37,7 @@ #include <QTemporaryFile> #include <QInputDialog> + HttpBrokerClient::HttpBrokerClient ( ONMainWindow* wnd, ConfigFile* cfg ) { config=cfg; @@ -56,30 +60,19 @@ HttpBrokerClient::HttpBrokerClient ( ONMainWindow* wnd, ConfigFile* cfg ) { sshBroker=false; - http=new QHttp ( this ); + if ((config->brokerCaCertFile.length() >0) && (QFile::exists(config->brokerCaCertFile))) { + QSslSocket::addDefaultCaCertificates(config->brokerCaCertFile, QSsl::Pem); + x2goDebug<<"Custom CA certificate file loaded into HTTPS broker client: "<<config->brokerCaCertFile; + } - if ( config->brokerurl.indexOf ( "https://" ) ==0 ) { - if ((config->brokerCaCertFile.length() >0) && (QFile::exists(config->brokerCaCertFile))) { + http=new QNetworkAccessManager ( this ); + x2goDebug<<"Setting up connection to broker: "<<config->brokerurl; - sslSocket = new QSslSocket(this); - connect ( sslSocket, SIGNAL ( sslErrors ( const QList<QSslError>& ) ),this, - SLOT ( slotSslErrors ( const QList<QSslError>& ) ) ); - http->setSocket(sslSocket); - sslSocket->addCaCertificates(config->brokerCaCertFile, QSsl::Pem); - x2goDebug<<"Custom CA certificate file loaded into HTTPS broker client: "<<config->brokerCaCertFile; + connect ( http, SIGNAL ( sslErrors ( QNetworkReply*, const QList<QSslError>& ) ),this, + SLOT ( slotSslErrors ( QNetworkReply*, const QList<QSslError>& ) ) ); - } else { - connect ( http, SIGNAL ( sslErrors ( const QList<QSslError>& ) ),this, - SLOT ( slotSslErrors ( const QList<QSslError>& ) ) ); - } - http->setHost ( lurl.host(),QHttp::ConnectionModeHttps, - lurl.port ( 443 ) ); - } else { - http->setHost ( lurl.host(),QHttp::ConnectionModeHttp, - lurl.port ( 80 ) ); - } - connect ( http,SIGNAL ( requestFinished ( int,bool ) ),this, - SLOT ( slotRequestFinished ( int,bool ) ) ); + connect ( http,SIGNAL ( finished (QNetworkReply*) ),this, + SLOT ( slotRequestFinished (QNetworkReply*) ) ); } } @@ -248,6 +241,7 @@ void HttpBrokerClient::slotSshUserAuthError(QString error) void HttpBrokerClient::getUserSessions() { QString brokerUser=config->brokerUser; + x2goDebug<<"called getUserSessions: brokeruser: "<<brokerUser<<" authid: "<<config->brokerUserId; if(mainWindow->getUsePGPCard()) brokerUser=mainWindow->getCardLogin(); config->sessiondata=QString::null; @@ -259,10 +253,11 @@ void HttpBrokerClient::getUserSessions() "user="<<brokerUser<<"&"<< "password="<<config->brokerPass<<"&"<< "authid="<<config->brokerUserId; - QUrl lurl ( config->brokerurl ); - httpSessionAnswer.close(); - httpSessionAnswer.setData ( 0,0 ); - sessionsRequest=http->post ( lurl.path(),req.toUtf8(),&httpSessionAnswer ); + + x2goDebug << "sending request: "<< req.toUtf8(); + QNetworkRequest request(QUrl(config->brokerurl)); + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); + sessionsRequest=http->post (request, req.toUtf8() ); } else { @@ -283,6 +278,7 @@ void HttpBrokerClient::getUserSessions() void HttpBrokerClient::selectUserSession(const QString& session) { + x2goDebug<<"called selectUserSessions"; QString brokerUser=config->brokerUser; if(mainWindow->getUsePGPCard()) brokerUser=mainWindow->getCardLogin(); @@ -296,10 +292,11 @@ void HttpBrokerClient::selectUserSession(const QString& session) "user="<<brokerUser<<"&"<< "password="<<config->brokerPass<<"&"<< "authid="<<config->brokerUserId; - QUrl lurl ( config->brokerurl ); - httpSessionAnswer.close(); - httpSessionAnswer.setData ( 0,0 ); - selSessRequest=http->post ( lurl.path(),req.toUtf8(),&httpSessionAnswer ); + x2goDebug << "sending request: "<< req.toUtf8(); + QNetworkRequest request(QUrl(config->brokerurl)); + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); + sessionsRequest=http->post (request, req.toUtf8() ); + } else { @@ -330,10 +327,10 @@ void HttpBrokerClient::changePassword(QString newPass) "user="<<brokerUser<<"&"<< "password="<<config->brokerPass<<"&"<< "authid="<<config->brokerUserId; - QUrl lurl ( config->brokerurl ); - httpSessionAnswer.close(); - httpSessionAnswer.setData ( 0,0 ); - chPassRequest=http->post ( lurl.path(),req.toUtf8(),&httpSessionAnswer ); + x2goDebug << "sending request: "<< req.toUtf8(); + QNetworkRequest request(QUrl(config->brokerurl)); + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); + sessionsRequest=http->post (request, req.toUtf8() ); } else { @@ -349,16 +346,16 @@ void HttpBrokerClient::changePassword(QString newPass) void HttpBrokerClient::testConnection() { + x2goDebug<<"called testConnection"; if(!sshBroker) { QString req; QTextStream ( &req ) << "task=testcon"; - QUrl lurl ( config->brokerurl ); - httpSessionAnswer.close(); - httpSessionAnswer.setData ( 0,0 ); - requestTime.start(); - testConRequest=http->post ( lurl.path(),req.toUtf8(),&httpSessionAnswer ); + x2goDebug << "sending request: "<< req.toUtf8(); + QNetworkRequest request(QUrl(config->brokerurl)); + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); + sessionsRequest=http->post (request, req.toUtf8() ); } else { @@ -392,6 +389,7 @@ void HttpBrokerClient::createIniFile(const QString& raw_content) bool HttpBrokerClient::checkAccess(QString answer ) { + x2goDebug<<"called checkAccess - answer was: "<<answer; if (answer.indexOf("Access granted")==-1) { QMessageBox::critical ( @@ -408,6 +406,7 @@ bool HttpBrokerClient::checkAccess(QString answer ) void HttpBrokerClient::slotConnectionTest(bool success, QString answer, int) { + x2goDebug<<"called slotConnectionTest"; if(!success) { x2goDebug<<answer; @@ -419,8 +418,8 @@ void HttpBrokerClient::slotConnectionTest(bool success, QString answer, int) return; if(!sshBroker) { - x2goDebug<<"elapsed: "<<requestTime.elapsed()<<"received:"<<httpSessionAnswer.size()<<endl; - emit connectionTime(requestTime.elapsed(),httpSessionAnswer.size()); + x2goDebug<<"elapsed: "<<requestTime.elapsed()<<"received:"<<answer.size()<<endl; + emit connectionTime(requestTime.elapsed(),answer.size()); } return; @@ -471,36 +470,38 @@ void HttpBrokerClient::slotSelectSession(bool success, QString answer, int) } -void HttpBrokerClient::slotRequestFinished ( int id, bool error ) +void HttpBrokerClient::slotRequestFinished ( QNetworkReply* reply ) { -// x2goDebug<<"http request "<<id<<", finished with: "<<error; - - if ( error ) + if(reply->error() != QNetworkReply::NoError) { - x2goDebug<<http->errorString(); - QMessageBox::critical(0,tr("Error"),http->errorString()); + x2goDebug<<"Broker HTTP request failed with error: "<<reply->errorString(); + QMessageBox::critical(0,tr("Error"),reply->errorString()); emit fatalHttpError(); return; } - QString answer ( httpSessionAnswer.data() ); - x2goDebug<<"cmd request answer: "<<answer; - if (id==testConRequest) + QString answer ( reply->readAll() ); + x2goDebug<<"A http request returned. Result was: "<<answer; + if (reply == testConRequest) { slotConnectionTest(true,answer,0); } - if (id == sessionsRequest) + if (reply == sessionsRequest) { slotListSessions(true, answer,0); } - if (id == selSessRequest) + if (reply == selSessRequest) { slotSelectSession(true,answer,0); } - if ( id == chPassRequest) + if (reply == chPassRequest) { slotPassChanged(true,answer,0); } + + // We receive ownership of the reply object + // and therefore need to handle deletion. + reply->deleteLater(); } void HttpBrokerClient::parseSession(QString sinfo) @@ -537,7 +538,7 @@ void HttpBrokerClient::parseSession(QString sinfo) } -void HttpBrokerClient::slotSslErrors ( const QList<QSslError> & errors ) +void HttpBrokerClient::slotSslErrors ( QNetworkReply* netReply, const QList<QSslError> & errors ) { QStringList err; QSslCertificate cert; @@ -564,7 +565,7 @@ void HttpBrokerClient::slotSslErrors ( const QList<QSslError> & errors ) QSslCertificate mcert ( &fl ); if ( mcert==cert ) { - http->ignoreSslErrors(); + netReply->ignoreSslErrors(); requestTime.restart(); return; } @@ -635,7 +636,7 @@ void HttpBrokerClient::slotSslErrors ( const QList<QSslError> & errors ) fl.open ( QIODevice::WriteOnly | QIODevice::Text ); QTextStream ( &fl ) <<cert.toPem(); fl.close(); - http->ignoreSslErrors(); + netReply->ignoreSslErrors(); x2goDebug<<"store certificate in "<<homeDir+"/.x2go/ssl/exceptions/"+ lurl.host() +"/"+fname; requestTime.restart(); diff --git a/httpbrokerclient.h b/httpbrokerclient.h index 4ea4a3d..8a772df 100644 --- a/httpbrokerclient.h +++ b/httpbrokerclient.h @@ -18,6 +18,10 @@ #ifndef HTTPBROKERCLIENT_H #define HTTPBROKERCLIENT_H #include "x2goclientconfig.h" +#include <QNetworkAccessManager> +#include <QUrl> +#include <QNetworkRequest> +#include <QNetworkReply> #include <QSslError> #include <QBuffer> #include <QObject> @@ -27,7 +31,7 @@ /** @author Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de> */ -class QHttp; +class QNetworkAccessManager; struct ConfigFile; class ONMainWindow; @@ -41,14 +45,13 @@ public: void changePassword(QString newPass); void testConnection(); private: - QBuffer httpCmdAnswer; - QBuffer httpSessionAnswer; - QHttp* http; + QNetworkAccessManager* http; + QNetworkRequest* netRequest; QSslSocket* sslSocket; - int sessionsRequest; - int selSessRequest; - int chPassRequest; - int testConRequest; + QNetworkReply* sessionsRequest; + QNetworkReply* selSessRequest; + QNetworkReply* chPassRequest; + QNetworkReply* testConRequest; QString newBrokerPass; ConfigFile* config; ONMainWindow* mainWindow; @@ -62,8 +65,8 @@ private: bool checkAccess(QString answer); private slots: - void slotRequestFinished ( int id, bool error ); - void slotSslErrors ( const QList<QSslError> & errors ) ; + void slotRequestFinished ( QNetworkReply* reply ); + void slotSslErrors ( QNetworkReply* netReply, const QList<QSslError> & errors ) ; QString getHexVal ( const QByteArray& ba ); void slotSshConnectionError ( QString message, QString lastSessionError ); void slotSshServerAuthError ( int error, QString sshMessage, SshMasterConnection* connection ); -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit 1bd49018334c1bc6f13569982ea93f19e56e41eb Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Mar 3 11:52:41 2014 +0100 Revert "Switch to QNetworkAccessManager." This reverts commit d02396443b667e3c2217aebc257ca515bcf2e402. --- debian/changelog | 4 -- httpbrokerclient.cpp | 113 +++++++++++++++++++++++++------------------------- httpbrokerclient.h | 23 +++++----- 3 files changed, 66 insertions(+), 74 deletions(-) diff --git a/debian/changelog b/debian/changelog index 896cde6..42c5799 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,10 +13,6 @@ x2goclient (4.0.2.0-0x2go1) UNRELEASED; urgency=low - Don't show GUI dialog for --version, --help, etc, if started from terminal on linux and mac. - If no user in session config, display system username in pass form. - - [ Josh Lukens ] - * New upstream version (4.0.2.0): - - Switch to QNetworkAccessManager. [ Mike Gabriel ] * debian/control: diff --git a/httpbrokerclient.cpp b/httpbrokerclient.cpp index fca59b4..4ca8e5d 100644 --- a/httpbrokerclient.cpp +++ b/httpbrokerclient.cpp @@ -16,11 +16,8 @@ ***************************************************************************/ #include "httpbrokerclient.h" -#include <QNetworkAccessManager> #include <QUrl> -#include <QNetworkRequest> -#include <QNetworkReply> -#include <QUuid> +#include <QHttp> #include <QTextStream> #include <QFile> #include <QDir> @@ -37,7 +34,6 @@ #include <QTemporaryFile> #include <QInputDialog> - HttpBrokerClient::HttpBrokerClient ( ONMainWindow* wnd, ConfigFile* cfg ) { config=cfg; @@ -60,19 +56,30 @@ HttpBrokerClient::HttpBrokerClient ( ONMainWindow* wnd, ConfigFile* cfg ) { sshBroker=false; - if ((config->brokerCaCertFile.length() >0) && (QFile::exists(config->brokerCaCertFile))) { - QSslSocket::addDefaultCaCertificates(config->brokerCaCertFile, QSsl::Pem); - x2goDebug<<"Custom CA certificate file loaded into HTTPS broker client: "<<config->brokerCaCertFile; - } + http=new QHttp ( this ); - http=new QNetworkAccessManager ( this ); - x2goDebug<<"Setting up connection to broker: "<<config->brokerurl; + if ( config->brokerurl.indexOf ( "https://" ) ==0 ) { + if ((config->brokerCaCertFile.length() >0) && (QFile::exists(config->brokerCaCertFile))) { - connect ( http, SIGNAL ( sslErrors ( QNetworkReply*, const QList<QSslError>& ) ),this, - SLOT ( slotSslErrors ( QNetworkReply*, const QList<QSslError>& ) ) ); + sslSocket = new QSslSocket(this); + connect ( sslSocket, SIGNAL ( sslErrors ( const QList<QSslError>& ) ),this, + SLOT ( slotSslErrors ( const QList<QSslError>& ) ) ); + http->setSocket(sslSocket); + sslSocket->addCaCertificates(config->brokerCaCertFile, QSsl::Pem); + x2goDebug<<"Custom CA certificate file loaded into HTTPS broker client: "<<config->brokerCaCertFile; - connect ( http,SIGNAL ( finished (QNetworkReply*) ),this, - SLOT ( slotRequestFinished (QNetworkReply*) ) ); + } else { + connect ( http, SIGNAL ( sslErrors ( const QList<QSslError>& ) ),this, + SLOT ( slotSslErrors ( const QList<QSslError>& ) ) ); + } + http->setHost ( lurl.host(),QHttp::ConnectionModeHttps, + lurl.port ( 443 ) ); + } else { + http->setHost ( lurl.host(),QHttp::ConnectionModeHttp, + lurl.port ( 80 ) ); + } + connect ( http,SIGNAL ( requestFinished ( int,bool ) ),this, + SLOT ( slotRequestFinished ( int,bool ) ) ); } } @@ -241,7 +248,6 @@ void HttpBrokerClient::slotSshUserAuthError(QString error) void HttpBrokerClient::getUserSessions() { QString brokerUser=config->brokerUser; - x2goDebug<<"called getUserSessions: brokeruser: "<<brokerUser<<" authid: "<<config->brokerUserId; if(mainWindow->getUsePGPCard()) brokerUser=mainWindow->getCardLogin(); config->sessiondata=QString::null; @@ -253,11 +259,10 @@ void HttpBrokerClient::getUserSessions() "user="<<brokerUser<<"&"<< "password="<<config->brokerPass<<"&"<< "authid="<<config->brokerUserId; - - x2goDebug << "sending request: "<< req.toUtf8(); - QNetworkRequest request(QUrl(config->brokerurl)); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - sessionsRequest=http->post (request, req.toUtf8() ); + QUrl lurl ( config->brokerurl ); + httpSessionAnswer.close(); + httpSessionAnswer.setData ( 0,0 ); + sessionsRequest=http->post ( lurl.path(),req.toUtf8(),&httpSessionAnswer ); } else { @@ -278,7 +283,6 @@ void HttpBrokerClient::getUserSessions() void HttpBrokerClient::selectUserSession(const QString& session) { - x2goDebug<<"called selectUserSessions"; QString brokerUser=config->brokerUser; if(mainWindow->getUsePGPCard()) brokerUser=mainWindow->getCardLogin(); @@ -292,11 +296,10 @@ void HttpBrokerClient::selectUserSession(const QString& session) "user="<<brokerUser<<"&"<< "password="<<config->brokerPass<<"&"<< "authid="<<config->brokerUserId; - x2goDebug << "sending request: "<< req.toUtf8(); - QNetworkRequest request(QUrl(config->brokerurl)); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - sessionsRequest=http->post (request, req.toUtf8() ); - + QUrl lurl ( config->brokerurl ); + httpSessionAnswer.close(); + httpSessionAnswer.setData ( 0,0 ); + selSessRequest=http->post ( lurl.path(),req.toUtf8(),&httpSessionAnswer ); } else { @@ -327,10 +330,10 @@ void HttpBrokerClient::changePassword(QString newPass) "user="<<brokerUser<<"&"<< "password="<<config->brokerPass<<"&"<< "authid="<<config->brokerUserId; - x2goDebug << "sending request: "<< req.toUtf8(); - QNetworkRequest request(QUrl(config->brokerurl)); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - sessionsRequest=http->post (request, req.toUtf8() ); + QUrl lurl ( config->brokerurl ); + httpSessionAnswer.close(); + httpSessionAnswer.setData ( 0,0 ); + chPassRequest=http->post ( lurl.path(),req.toUtf8(),&httpSessionAnswer ); } else { @@ -346,16 +349,16 @@ void HttpBrokerClient::changePassword(QString newPass) void HttpBrokerClient::testConnection() { - x2goDebug<<"called testConnection"; if(!sshBroker) { QString req; QTextStream ( &req ) << "task=testcon"; - x2goDebug << "sending request: "<< req.toUtf8(); - QNetworkRequest request(QUrl(config->brokerurl)); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - sessionsRequest=http->post (request, req.toUtf8() ); + QUrl lurl ( config->brokerurl ); + httpSessionAnswer.close(); + httpSessionAnswer.setData ( 0,0 ); + requestTime.start(); + testConRequest=http->post ( lurl.path(),req.toUtf8(),&httpSessionAnswer ); } else { @@ -389,7 +392,6 @@ void HttpBrokerClient::createIniFile(const QString& raw_content) bool HttpBrokerClient::checkAccess(QString answer ) { - x2goDebug<<"called checkAccess - answer was: "<<answer; if (answer.indexOf("Access granted")==-1) { QMessageBox::critical ( @@ -406,7 +408,6 @@ bool HttpBrokerClient::checkAccess(QString answer ) void HttpBrokerClient::slotConnectionTest(bool success, QString answer, int) { - x2goDebug<<"called slotConnectionTest"; if(!success) { x2goDebug<<answer; @@ -418,8 +419,8 @@ void HttpBrokerClient::slotConnectionTest(bool success, QString answer, int) return; if(!sshBroker) { - x2goDebug<<"elapsed: "<<requestTime.elapsed()<<"received:"<<answer.size()<<endl; - emit connectionTime(requestTime.elapsed(),answer.size()); + x2goDebug<<"elapsed: "<<requestTime.elapsed()<<"received:"<<httpSessionAnswer.size()<<endl; + emit connectionTime(requestTime.elapsed(),httpSessionAnswer.size()); } return; @@ -470,38 +471,36 @@ void HttpBrokerClient::slotSelectSession(bool success, QString answer, int) } -void HttpBrokerClient::slotRequestFinished ( QNetworkReply* reply ) +void HttpBrokerClient::slotRequestFinished ( int id, bool error ) { - if(reply->error() != QNetworkReply::NoError) +// x2goDebug<<"http request "<<id<<", finished with: "<<error; + + if ( error ) { - x2goDebug<<"Broker HTTP request failed with error: "<<reply->errorString(); - QMessageBox::critical(0,tr("Error"),reply->errorString()); + x2goDebug<<http->errorString(); + QMessageBox::critical(0,tr("Error"),http->errorString()); emit fatalHttpError(); return; } - QString answer ( reply->readAll() ); - x2goDebug<<"A http request returned. Result was: "<<answer; - if (reply == testConRequest) + QString answer ( httpSessionAnswer.data() ); + x2goDebug<<"cmd request answer: "<<answer; + if (id==testConRequest) { slotConnectionTest(true,answer,0); } - if (reply == sessionsRequest) + if (id == sessionsRequest) { slotListSessions(true, answer,0); } - if (reply == selSessRequest) + if (id == selSessRequest) { slotSelectSession(true,answer,0); } - if (reply == chPassRequest) + if ( id == chPassRequest) { slotPassChanged(true,answer,0); } - - // We receive ownership of the reply object - // and therefore need to handle deletion. - reply->deleteLater(); } void HttpBrokerClient::parseSession(QString sinfo) @@ -538,7 +537,7 @@ void HttpBrokerClient::parseSession(QString sinfo) } -void HttpBrokerClient::slotSslErrors ( QNetworkReply* netReply, const QList<QSslError> & errors ) +void HttpBrokerClient::slotSslErrors ( const QList<QSslError> & errors ) { QStringList err; QSslCertificate cert; @@ -565,7 +564,7 @@ void HttpBrokerClient::slotSslErrors ( QNetworkReply* netReply, const QList<QSsl QSslCertificate mcert ( &fl ); if ( mcert==cert ) { - netReply->ignoreSslErrors(); + http->ignoreSslErrors(); requestTime.restart(); return; } @@ -636,7 +635,7 @@ void HttpBrokerClient::slotSslErrors ( QNetworkReply* netReply, const QList<QSsl fl.open ( QIODevice::WriteOnly | QIODevice::Text ); QTextStream ( &fl ) <<cert.toPem(); fl.close(); - netReply->ignoreSslErrors(); + http->ignoreSslErrors(); x2goDebug<<"store certificate in "<<homeDir+"/.x2go/ssl/exceptions/"+ lurl.host() +"/"+fname; requestTime.restart(); diff --git a/httpbrokerclient.h b/httpbrokerclient.h index 8a772df..4ea4a3d 100644 --- a/httpbrokerclient.h +++ b/httpbrokerclient.h @@ -18,10 +18,6 @@ #ifndef HTTPBROKERCLIENT_H #define HTTPBROKERCLIENT_H #include "x2goclientconfig.h" -#include <QNetworkAccessManager> -#include <QUrl> -#include <QNetworkRequest> -#include <QNetworkReply> #include <QSslError> #include <QBuffer> #include <QObject> @@ -31,7 +27,7 @@ /** @author Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de> */ -class QNetworkAccessManager; +class QHttp; struct ConfigFile; class ONMainWindow; @@ -45,13 +41,14 @@ public: void changePassword(QString newPass); void testConnection(); private: - QNetworkAccessManager* http; - QNetworkRequest* netRequest; + QBuffer httpCmdAnswer; + QBuffer httpSessionAnswer; + QHttp* http; QSslSocket* sslSocket; - QNetworkReply* sessionsRequest; - QNetworkReply* selSessRequest; - QNetworkReply* chPassRequest; - QNetworkReply* testConRequest; + int sessionsRequest; + int selSessRequest; + int chPassRequest; + int testConRequest; QString newBrokerPass; ConfigFile* config; ONMainWindow* mainWindow; @@ -65,8 +62,8 @@ private: bool checkAccess(QString answer); private slots: - void slotRequestFinished ( QNetworkReply* reply ); - void slotSslErrors ( QNetworkReply* netReply, const QList<QSslError> & errors ) ; + void slotRequestFinished ( int id, bool error ); + void slotSslErrors ( const QList<QSslError> & errors ) ; QString getHexVal ( const QByteArray& ba ); void slotSshConnectionError ( QString message, QString lastSessionError ); void slotSshServerAuthError ( int error, QString sshMessage, SshMasterConnection* connection ); -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git