Committing updates.

This commit is contained in:
Преподобный Ален
2021-11-01 19:12:48 +03:00
parent 8a20f01b73
commit 2832907231

View File

@@ -1627,13 +1627,21 @@ namespace Apostol {
CHTTPRequest::Prepare(ARequest, "GET", CString().Format("/api/v1/key/public?account=%s&type=pgp", PGP.Name.c_str()).c_str()); CHTTPRequest::Prepare(ARequest, "GET", CString().Format("/api/v1/key/public?account=%s&type=pgp", PGP.Name.c_str()).c_str());
ARequest->AddHeader("Authorization", "Bearer " + m_Tokens[SYSTEM_PROVIDER_NAME]["access_token"]); ARequest->AddHeader("Authorization", "Bearer " + m_Tokens[SYSTEM_PROVIDER_NAME]["access_token"]);
DebugRequest(ARequest);
}; };
auto OnExecute = [this, &PGP](CTCPConnection *AConnection) { auto OnExecute = [this, &PGP](CTCPConnection *AConnection) {
auto pConnection = dynamic_cast<CHTTPClientConnection *> (AConnection); auto pConnection = dynamic_cast<CHTTPClientConnection *> (AConnection);
if (pConnection == nullptr)
return true;
auto pReply = pConnection->Reply(); auto pReply = pConnection->Reply();
DebugReply(pReply);
try { try {
PGP.StatusTime = Now(); PGP.StatusTime = Now();
PGP.Status = CKeyContext::ksError; PGP.Status = CKeyContext::ksError;
@@ -1670,17 +1678,25 @@ namespace Apostol {
} }
pConnection->CloseConnection(true); pConnection->CloseConnection(true);
return true; return true;
}; };
auto OnException = [this, &PGP](CTCPConnection *AConnection, const Delphi::Exception::Exception &E) { auto OnException = [this, &PGP](CTCPConnection *AConnection, const Delphi::Exception::Exception &E) {
auto pConnection = dynamic_cast<CHTTPClientConnection *> (AConnection); auto pConnection = dynamic_cast<CHTTPClientConnection *> (AConnection);
if (pConnection != nullptr) {
auto pClient = dynamic_cast<CHTTPClient *> (pConnection->Client()); auto pClient = dynamic_cast<CHTTPClient *> (pConnection->Client());
if (pClient != nullptr) {
Log()->Error(APP_LOG_EMERG, 0, "[%s:%d] %s", pClient->Host().c_str(), pClient->Port(), E.what()); Log()->Error(APP_LOG_EMERG, 0, "[%s:%d] %s", pClient->Host().c_str(), pClient->Port(), E.what());
PGP.Status = CKeyContext::ksError; PGP.Status = CKeyContext::ksError;
m_RandomDate = Now() + (CDateTime) 5 / SecsPerDay; m_RandomDate = Now() + (CDateTime) 5 / SecsPerDay;
}
DebugReply(pConnection->Reply());
}
}; };
CLocation Location(caServerContext.URI); CLocation Location(caServerContext.URI);