summaryrefslogtreecommitdiff
path: root/protocols/CloudFile/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-01-13 16:48:55 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-01-13 16:48:55 +0300
commit87a2660299edd64cbb6f6c92c33683e91a6d187c (patch)
treea1b0777ec5b8afc0c49fbb66cf6a122b5ac82c6d /protocols/CloudFile/src
parent21f52dbfa251d171b4cc9dc315e8736da2e2be08 (diff)
Netlib_GetHeader() - handful utility to avoid writing cycles
Diffstat (limited to 'protocols/CloudFile/src')
-rw-r--r--protocols/CloudFile/src/Services/google_service.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/protocols/CloudFile/src/Services/google_service.cpp b/protocols/CloudFile/src/Services/google_service.cpp
index db4cfc1cbd..c7498d936c 100644
--- a/protocols/CloudFile/src/Services/google_service.cpp
+++ b/protocols/CloudFile/src/Services/google_service.cpp
@@ -179,16 +179,11 @@ auto CGDriveService::CreateUploadSession(const std::string &parentId, const std:
HandleHttpError(response);
- if (HTTP_CODE_SUCCESS(response->resultCode)) {
- for (int i = 0; i < response->headersCount; i++) {
- if (mir_strcmpi(response->headers[i].szName, "Location"))
- continue;
- return std::string(response->headers[i].szValue);
- }
- }
+ if (HTTP_CODE_SUCCESS(response->resultCode))
+ if (auto *pszHdr = Netlib_GetHeader(response, "Location"))
+ return std::string(pszHdr);
HttpResponseToError(response);
-
return std::string();
}