Switched DomainServer to NetworkAccessManager

This commit is contained in:
Atlante45 2014-07-02 10:26:38 -07:00
parent 7c3292a41b
commit 36fb530594
3 changed files with 2 additions and 7 deletions

View file

@ -10,7 +10,6 @@
// //
#include <QJsonObject> #include <QJsonObject>
#include <QNetworkAccessManager>
#include <QTimer> #include <QTimer>
#include <QUuid> #include <QUuid>

View file

@ -51,8 +51,6 @@ DomainServer::DomainServer(int argc, char* argv[]) :
_argumentVariantMap = HifiConfigVariantMap::mergeCLParametersWithJSONConfig(arguments()); _argumentVariantMap = HifiConfigVariantMap::mergeCLParametersWithJSONConfig(arguments());
_networkAccessManager = new QNetworkAccessManager(this);
if (optionallyReadX509KeyAndCertificate() && optionallySetupOAuth() && optionallySetupAssignmentPayment()) { if (optionallyReadX509KeyAndCertificate() && optionallySetupOAuth() && optionallySetupAssignmentPayment()) {
// we either read a certificate and private key or were not passed one // we either read a certificate and private key or were not passed one
// and completed login or did not need to // and completed login or did not need to
@ -1196,7 +1194,7 @@ bool DomainServer::handleHTTPSRequest(HTTPSConnection* connection, const QUrl &u
QNetworkRequest tokenRequest(tokenRequestUrl); QNetworkRequest tokenRequest(tokenRequestUrl);
tokenRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); tokenRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
QNetworkReply* tokenReply = _networkAccessManager->post(tokenRequest, tokenPostBody.toLocal8Bit()); QNetworkReply* tokenReply = NetworkAccessManager::getInstance().post(tokenRequest, tokenPostBody.toLocal8Bit());
qDebug() << "Requesting a token for user with session UUID" << uuidStringWithoutCurlyBraces(stateUUID); qDebug() << "Requesting a token for user with session UUID" << uuidStringWithoutCurlyBraces(stateUUID);
@ -1233,7 +1231,7 @@ void DomainServer::handleTokenRequestFinished() {
profileURL.setPath("/api/v1/users/profile"); profileURL.setPath("/api/v1/users/profile");
profileURL.setQuery(QString("%1=%2").arg(OAUTH_JSON_ACCESS_TOKEN_KEY, accessToken)); profileURL.setQuery(QString("%1=%2").arg(OAUTH_JSON_ACCESS_TOKEN_KEY, accessToken));
QNetworkReply* profileReply = _networkAccessManager->get(QNetworkRequest(profileURL)); QNetworkReply* profileReply = NetworkAccessManager::getInstance().get(QNetworkRequest(profileURL));
qDebug() << "Requesting access token for user with session UUID" << uuidStringWithoutCurlyBraces(matchingSessionUUID); qDebug() << "Requesting access token for user with session UUID" << uuidStringWithoutCurlyBraces(matchingSessionUUID);

View file

@ -103,8 +103,6 @@ private:
bool _isUsingDTLS; bool _isUsingDTLS;
QNetworkAccessManager* _networkAccessManager;
QUrl _oauthProviderURL; QUrl _oauthProviderURL;
QString _oauthClientID; QString _oauthClientID;
QString _oauthClientSecret; QString _oauthClientSecret;