feat: Remove req lib reference

This commit is contained in:
kradchen
2024-06-12 13:07:18 +08:00
parent 093b2451c1
commit 1c9af2aae9
2 changed files with 4 additions and 27 deletions

View File

@@ -1,36 +1,16 @@
#include "notify.h"
#include "Request.h"
#include "log/log.h"
namespace Recon {
std::string ReconID;
Req::Request req;
bool notifyStart(const std::string& aReconID ){
ReconID = aReconID;
Req::Request::Init();
req.setClientCertificate("/home/krad/workdir/ReconTester/client.crt","/home/krad/workdir/ReconTester/client.key");
std::string str = "{\"ReconID\": \""+ReconID+"\"}";
std::unordered_map<std::string, std::string> headers;
headers["Content-Type"] = "application/json";
auto resp = req.post("https://localhost:5002/Task/Start/",str,headers);
return resp->httpCode() == 200;
return true;
}
bool notifyFinish(){
std::string str = "{\"ReconID\": \""+ReconID+"\"}";
std::unordered_map<std::string, std::string> headers;
headers["Content-Type"] = "application/json";
auto resp = req.post("https://localhost:5002/Task/Finish/",str,headers);
Req::Request::Dispose();
return resp->httpCode() == 200;
return true;
}
bool notifyProgress( int percent){
char buffer[2048] = {0};
sprintf(buffer, "https://localhost:5002/Task/Notify/%d/", percent);
std::string str = "{\"ReconID\": \""+ReconID+"\"}";
std::unordered_map<std::string, std::string> headers;
headers["Content-Type"] = "application/json";
auto resp = req.post(buffer,str,headers);
return resp->httpCode() == 200;
return true;
}
}