From 87a2660299edd64cbb6f6c92c33683e91a6d187c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 Jan 2020 16:48:55 +0300 Subject: Netlib_GetHeader() - handful utility to avoid writing cycles --- protocols/CloudFile/src/Services/google_service.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'protocols/CloudFile/src') 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(); } -- cgit v1.2.3