diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-05 15:54:03 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-05 15:54:03 +0300 |
commit | 14c4e44a0a91e1ad701d4ae3c58185d25118e64e (patch) | |
tree | 50f36035466f355c74373e757bc00b6610ce6267 /protocols/CloudFile/src/Services | |
parent | 94667140aeb3886d22e4c1301423fe99aaf3fba4 (diff) |
Netlib:
- NETLIBHTTPHEADER & NETLIBHTTPREQUEST obsoleted;
- NETLIBHTTPREQUEST divided into MHttpRequest & MHttpResponse;
- MHttpHeaders now manager headers both for MHttpRequest & MHttpResponse;
Diffstat (limited to 'protocols/CloudFile/src/Services')
4 files changed, 12 insertions, 12 deletions
diff --git a/protocols/CloudFile/src/Services/dropbox_service.cpp b/protocols/CloudFile/src/Services/dropbox_service.cpp index 805a7f2800..92b00fc493 100644 --- a/protocols/CloudFile/src/Services/dropbox_service.cpp +++ b/protocols/CloudFile/src/Services/dropbox_service.cpp @@ -85,7 +85,7 @@ void CDropboxService::RequestAccessTokenThread(void *param) return; } - JSONNode root = JSONNode::parse(response->pData); + JSONNode root = JSONNode::parse(response->body); if (root.empty()) { Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); @@ -206,7 +206,7 @@ auto CDropboxService::CreateSharedLink(const std::string &path) if (!response || response->resultCode != HTTP_CODE_CONFLICT) HttpResponseToError(response); - JSONNode root = JSONNode::parse(response->pData); + JSONNode root = JSONNode::parse(response->body); if (root.isnull()) throw Exception(HttpStatusToError()); diff --git a/protocols/CloudFile/src/Services/google_service.cpp b/protocols/CloudFile/src/Services/google_service.cpp index 58b32eaa7f..fea2c3b2b4 100644 --- a/protocols/CloudFile/src/Services/google_service.cpp +++ b/protocols/CloudFile/src/Services/google_service.cpp @@ -100,8 +100,8 @@ void CGDriveService::RequestAccessTokenThread(void *param) NLHR_PTR response(request.Send(m_hConnection)); if (response == nullptr || response->resultCode != HTTP_CODE_OK) { - const char *error = response && response->dataLength - ? response->pData + const char *error = response && response->body.GetLength() + ? response->body : HttpStatusToError(response ? response->resultCode : 0); Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), error); @@ -110,7 +110,7 @@ void CGDriveService::RequestAccessTokenThread(void *param) return; } - JSONNode root = JSONNode::parse(response->pData); + JSONNode root = JSONNode::parse(response->body); if (root.empty()) { Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); @@ -180,7 +180,7 @@ auto CGDriveService::CreateUploadSession(const std::string &parentId, const std: HandleHttpError(response); if (HTTP_CODE_SUCCESS(response->resultCode)) - if (auto *pszHdr = Netlib_GetHeader(response, "Location")) + if (auto *pszHdr = response->FindHeader("Location")) return std::string(pszHdr); HttpResponseToError(response); diff --git a/protocols/CloudFile/src/Services/microsoft_service.cpp b/protocols/CloudFile/src/Services/microsoft_service.cpp index 8d63f4a23f..17115235cd 100644 --- a/protocols/CloudFile/src/Services/microsoft_service.cpp +++ b/protocols/CloudFile/src/Services/microsoft_service.cpp @@ -100,8 +100,8 @@ void COneDriveService::RequestAccessTokenThread(void *param) NLHR_PTR response(request.Send(m_hConnection)); if (response == nullptr || response->resultCode != HTTP_CODE_OK) { - const char *error = response->dataLength - ? response->pData + const char *error = response->body.GetLength() + ? response->body : HttpStatusToError(response->resultCode); Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), error); @@ -110,7 +110,7 @@ void COneDriveService::RequestAccessTokenThread(void *param) return; } - JSONNode root = JSONNode::parse(response->pData); + JSONNode root = JSONNode::parse(response->body); if (root.empty()) { Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); diff --git a/protocols/CloudFile/src/Services/yandex_service.cpp b/protocols/CloudFile/src/Services/yandex_service.cpp index f21e9ef2e0..892821e0c4 100644 --- a/protocols/CloudFile/src/Services/yandex_service.cpp +++ b/protocols/CloudFile/src/Services/yandex_service.cpp @@ -102,8 +102,8 @@ void CYandexService::RequestAccessTokenThread(void *param) NLHR_PTR response(request.Send(m_hConnection)); if (response == nullptr || response->resultCode != HTTP_CODE_OK) { - const char *error = response->dataLength - ? response->pData + const char *error = response->body.GetLength() + ? response->body : HttpStatusToError(response->resultCode); Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), error); @@ -112,7 +112,7 @@ void CYandexService::RequestAccessTokenThread(void *param) return; } - JSONNode root = JSONNode::parse(response->pData); + JSONNode root = JSONNode::parse(response->body); if (root.empty()) { Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); |