forked from ondra/colnod-connector
fix, getsubject works
This commit is contained in:
parent
41422bfb6e
commit
dcc88a669b
@ -4,7 +4,7 @@ RequestManager::RequestManager()
|
||||
{
|
||||
manager = new QNetworkAccessManager();
|
||||
token = "";
|
||||
loginStatus = true; //should be false, true for testing request header
|
||||
loginStatus = false; //should be false, true for testing request header
|
||||
|
||||
|
||||
/*
|
||||
@ -57,9 +57,9 @@ void RequestManager::getRequest(QString endpoint)
|
||||
{
|
||||
// login(config.object()["host"].toString(), config.object()["username"].toString(), config.object()["password"].toString());
|
||||
login(host, user, password);
|
||||
// QEventLoop loop;
|
||||
// QObject::connect(this, &RequestManager::successLogin, &loop, &QEventLoop::quit);
|
||||
// loop.exec();
|
||||
QEventLoop loop;
|
||||
QObject::connect(this, &RequestManager::successLogin, &loop, &QEventLoop::quit);
|
||||
loop.exec();
|
||||
}
|
||||
|
||||
//
|
||||
@ -68,7 +68,7 @@ void RequestManager::getRequest(QString endpoint)
|
||||
|
||||
QNetworkRequest request;
|
||||
request.setUrl(host + endpoint);
|
||||
qDebug() << authHeader;
|
||||
qDebug() << "Auth: " << authHeader;
|
||||
request.setRawHeader("Authorization", authHeader.toLocal8Bit());
|
||||
//request.setRawHeader("User-Agent", "curl/7.65.3");
|
||||
//request.setRawHeader("Connection", "Keep-Alive");
|
||||
@ -126,7 +126,7 @@ void RequestManager::prepareAuthHeader()
|
||||
{
|
||||
token = getFromJson(jsonResponse, "id");
|
||||
QString authValue = token + ":";
|
||||
authHeader = "Basic" + authValue.toLocal8Bit().toBase64();
|
||||
authHeader = "Basic " + authValue.toLocal8Bit().toBase64();
|
||||
}
|
||||
|
||||
void RequestManager::onSSLError(QNetworkReply *reply, const QList<QSslError> &errors)
|
||||
|
||||
@ -61,8 +61,8 @@ private:
|
||||
QNetworkAccessManager* manager;
|
||||
QJsonDocument config;
|
||||
QString authHeader;
|
||||
//QString host = "https://192.168.1.3:8443";
|
||||
QString host = "http://localhost:8080";
|
||||
QString host = "https://192.168.1.3:8443";
|
||||
//QString host = "http://localhost:8080";
|
||||
|
||||
QString password = "spaceti1";
|
||||
QString user = "spaceti";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user