forked from ondra/colnod-connector
curl vs qt requests
This commit is contained in:
parent
81a9c66ded
commit
41422bfb6e
9
http/curlauth.txt
Normal file
9
http/curlauth.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
POST /AaaManager/authSession HTTP/1.1
|
||||||
|
Host: localhost:8080
|
||||||
|
Authorization: Basic c3BhY2V0aTpFN0ZFQTA3REJDODJGQjlCQTM0QjJFNDUzRTJFRkU4OUYwNTgzRTcxODc1NDM1MDdFRjExRTg0NzI2MDcxRkU0Mjg0NDUzNzJGMkU0NkI0NTVFQjBDNzk3NDdDNTFFMzYyRjQwM0NFMzk0NzNBMkE4QzJERkEwQ0U1Qzk4MjZDMA==
|
||||||
|
User-Agent: curl/7.65.3
|
||||||
|
Accept: */*
|
||||||
|
Content-Type: application/json
|
||||||
|
Content-Length: 164
|
||||||
|
|
||||||
|
{"password":"E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0","username":"spaceti"}
|
||||||
6
http/curlsubject.txt
Normal file
6
http/curlsubject.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
POST /SubjectManager/getSubjects HTTP/1.1
|
||||||
|
Host: localhost:8080
|
||||||
|
Authorization: Basic ZmYwMzYwZjYtMzRmZC00ZjAwLTlhNTYtMWZiMzhmNjlhNDIzOg==
|
||||||
|
User-Agent: curl/7.65.3
|
||||||
|
Accept: */*
|
||||||
|
|
||||||
14
http/qtauth.txt
Normal file
14
http/qtauth.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
POST /AaaManager/authSession HTTP/1.1
|
||||||
|
Host: localhost:8080
|
||||||
|
Authorization: Basic c3BhY2V0aTpFN0ZFQTA3REJDODJGQjlCQTM0QjJFNDUzRTJFRkU4OUYwNTgzRTcxODc1NDM1MDdFRjExRTg0NzI2MDcxRkU0Mjg0NDUzNzJGMkU0NkI0NTVFQjBDNzk3NDdDNTFFMzYyRjQwM0NFMzk0NzNBMkE4QzJERkEwQ0U1Qzk4MjZDMA==
|
||||||
|
Content-Type: application/json; charset=UTF-8
|
||||||
|
Content-Length: 178
|
||||||
|
Connection: Keep-Alive
|
||||||
|
Accept-Encoding: gzip, deflate
|
||||||
|
Accept-Language: en-AI,*
|
||||||
|
User-Agent: Mozilla/5.0
|
||||||
|
|
||||||
|
{
|
||||||
|
"password": "E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0",
|
||||||
|
"username": "spaceti"
|
||||||
|
}
|
||||||
14
http/qtrequestoutput.txt
Normal file
14
http/qtrequestoutput.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
POST /AaaManager/authSession HTTP/1.1
|
||||||
|
Host: localhost:8080
|
||||||
|
Authorization: Basic c3BhY2V0aTpFN0ZFQTA3REJDODJGQjlCQTM0QjJFNDUzRTJFRkU4OUYwNTgzRTcxODc1NDM1MDdFRjExRTg0NzI2MDcxRkU0Mjg0NDUzNzJGMkU0NkI0NTVFQjBDNzk3NDdDNTFFMzYyRjQwM0NFMzk0NzNBMkE4QzJERkEwQ0U1Qzk4MjZDMA==
|
||||||
|
Content-Type: application/json; charset=UTF-8
|
||||||
|
Content-Length: 178
|
||||||
|
Connection: Keep-Alive
|
||||||
|
Accept-Encoding: gzip, deflate
|
||||||
|
Accept-Language: en-AI,*
|
||||||
|
User-Agent: Mozilla/5.0
|
||||||
|
|
||||||
|
{
|
||||||
|
"password": "E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0",
|
||||||
|
"username": "spaceti"
|
||||||
|
}
|
||||||
8
http/qtrequestoutputsubject.txt
Normal file
8
http/qtrequestoutputsubject.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
POST /SubjectManager/getSubjects HTTP/1.1
|
||||||
|
Host: localhost:8080
|
||||||
|
Content-Length: 0
|
||||||
|
Connection: Keep-Alive
|
||||||
|
Accept-Encoding: gzip, deflate
|
||||||
|
Accept-Language: en-AI,*
|
||||||
|
User-Agent: Mozilla/5.0
|
||||||
|
|
||||||
8
http/qtsubject.txt
Normal file
8
http/qtsubject.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
POST /SubjectManager/getSubjects HTTP/1.1
|
||||||
|
Host: localhost:8080
|
||||||
|
Content-Length: 0
|
||||||
|
Connection: Keep-Alive
|
||||||
|
Accept-Encoding: gzip, deflate
|
||||||
|
Accept-Language: en-AI,*
|
||||||
|
User-Agent: Mozilla/5.0
|
||||||
|
|
||||||
@ -4,7 +4,7 @@ RequestManager::RequestManager()
|
|||||||
{
|
{
|
||||||
manager = new QNetworkAccessManager();
|
manager = new QNetworkAccessManager();
|
||||||
token = "";
|
token = "";
|
||||||
loginStatus = false; //should be false, true for testing request header
|
loginStatus = true; //should be false, true for testing request header
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -70,11 +70,11 @@ void RequestManager::getRequest(QString endpoint)
|
|||||||
request.setUrl(host + endpoint);
|
request.setUrl(host + endpoint);
|
||||||
qDebug() << authHeader;
|
qDebug() << authHeader;
|
||||||
request.setRawHeader("Authorization", authHeader.toLocal8Bit());
|
request.setRawHeader("Authorization", authHeader.toLocal8Bit());
|
||||||
request.setRawHeader("User-Agent", "curl/7.65.3");
|
//request.setRawHeader("User-Agent", "curl/7.65.3");
|
||||||
request.setRawHeader("Connection", "Keep-Alive");
|
//request.setRawHeader("Connection", "Keep-Alive");
|
||||||
request.setRawHeader("Accept", "*/*");
|
//request.setRawHeader("Accept", "*/*");
|
||||||
request.setRawHeader("Accept-Encoding", "*");
|
//request.setRawHeader("Accept-Encoding", "*");
|
||||||
request.setRawHeader("Accept-Language", "*");
|
//request.setRawHeader("Accept-Language", "*");
|
||||||
|
|
||||||
QNetworkReply* reply = manager->post(request, QByteArray());
|
QNetworkReply* reply = manager->post(request, QByteArray());
|
||||||
|
|
||||||
@ -93,6 +93,7 @@ void RequestManager::getRequest(QString endpoint)
|
|||||||
getRequest(endpoint);
|
getRequest(endpoint);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
qDebug() << reply->rawHeaderPairs();
|
||||||
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
|
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
|
||||||
jsonResponse = reply->readAll();
|
jsonResponse = reply->readAll();
|
||||||
emit responseReady();
|
emit responseReady();
|
||||||
|
|||||||
@ -61,7 +61,9 @@ private:
|
|||||||
QNetworkAccessManager* manager;
|
QNetworkAccessManager* manager;
|
||||||
QJsonDocument config;
|
QJsonDocument config;
|
||||||
QString authHeader;
|
QString authHeader;
|
||||||
QString host = "https://192.168.1.3:8443";
|
//QString host = "https://192.168.1.3:8443";
|
||||||
|
QString host = "http://localhost:8080";
|
||||||
|
|
||||||
QString password = "spaceti1";
|
QString password = "spaceti1";
|
||||||
QString user = "spaceti";
|
QString user = "spaceti";
|
||||||
QString token;
|
QString token;
|
||||||
|
|||||||
@ -162,7 +162,7 @@ void UnitTest::debugConnection()
|
|||||||
|
|
||||||
QString token = testAccess->getToken();
|
QString token = testAccess->getToken();
|
||||||
token = token + ":";*/
|
token = token + ":";*/
|
||||||
tmp = "POST /SubjectManager/getSubjects HTTP/1.1\r\nHost: 192.168.1.3:8443\r\nAuthorization: Basic " + tkn.toUtf8().toBase64() + "\r\nUser-Agent: curl/7.65.3\r\nAccept: */*\r\nContent-Type: application/json\r\nContent-Length: 0\r\n\r\n";
|
tmp = "POST /SubjectManager/getSubjects HTTP/1.1\r\nHost: 192.168.1.3:8443\r\nAuthorization: Basic " + tkn.toUtf8().toBase64() + "\r\nUser-Agent: curl/7.65.3\r\nAccept: */*\r\n\r\n";
|
||||||
QFile file("output1234.txt");
|
QFile file("output1234.txt");
|
||||||
file.open(QIODevice::ReadWrite);
|
file.open(QIODevice::ReadWrite);
|
||||||
QTextStream st(&file);
|
QTextStream st(&file);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user