Merge pull request #7971 from birarda/session-id-with-place-request

optionally include the metaverse session ID as HTTP header when sending usage data
This commit is contained in:
Brad Hefta-Gaub 2016-05-25 17:14:27 -07:00
commit f2acc82899
3 changed files with 19 additions and 2 deletions

View file

@ -127,6 +127,10 @@ void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply
if (!dataObject.isEmpty()) {
_sessionID = dataObject[SESSION_ID_KEY].toString();
// give that session ID to the account manager
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->setSessionID(_sessionID);
}
}

View file

@ -9,6 +9,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "AccountManager.h"
#include <memory>
#include <QtCore/QDataStream>
@ -26,13 +28,13 @@
#include <SettingHandle.h>
#include "NetworkLogging.h"
#include "NodeList.h"
#include "udt/PacketHeaders.h"
#include "RSAKeypairGenerator.h"
#include "SharedUtil.h"
#include "UserActivityLogger.h"
#include "AccountManager.h"
#include "NetworkLogging.h"
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
@ -216,6 +218,13 @@ void AccountManager::sendRequest(const QString& path,
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
// if we're allowed to send usage data, include whatever the current session ID is with this request
auto& activityLogger = UserActivityLogger::getInstance();
if (activityLogger.isEnabled()) {
static const QString METAVERSE_SESSION_ID_HEADER = "HFM-SessionID";
networkRequest.setRawHeader(METAVERSE_SESSION_ID_HEADER.toLocal8Bit(), _sessionID.toString().toLocal8Bit());
}
QUrl requestURL = _authURL;
if (path.startsWith("/")) {

View file

@ -86,6 +86,8 @@ public:
static QJsonObject dataObjectFromResponse(QNetworkReply& requestReply);
void setSessionID(const QUuid& sessionID) { _sessionID = sessionID; }
public slots:
void requestAccessToken(const QString& login, const QString& password);
@ -136,6 +138,8 @@ private:
bool _isWaitingForKeypairResponse { false };
QByteArray _pendingPrivateKey;
QUuid _sessionID;
};
#endif // hifi_AccountManager_h