aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/projectstore
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-09-29 10:36:32 +0200
committerGitHub Enterprise <[email protected]>2025-09-29 10:36:32 +0200
commit2f0efec7ab0430f4f4858db87b7eecfbccc0f47c (patch)
tree80ce35992a220260cf070fac739626f555de738a /src/zenserver/projectstore
parentfixed race condition in zen::logging::Get (#519) (diff)
downloadzen-2f0efec7ab0430f4f4858db87b7eecfbccc0f47c.tar.xz
zen-2f0efec7ab0430f4f4858db87b7eecfbccc0f47c.zip
make cpr a HttpClient implementation detail (#517)
these changes remove cpr from anything which is not `HttpClient` internals. The goal is to eventually replace cpr with a more direct curl interface to eliminate cpr since it's proven problematic due to their development practices which frequently breaks APIs and prevents us from updating vcpkg. But this PR is limited to refactoring existing cpr code to use `HttpClient` instead.
Diffstat (limited to 'src/zenserver/projectstore')
-rw-r--r--src/zenserver/projectstore/buildsremoteprojectstore.cpp14
-rw-r--r--src/zenserver/projectstore/projectstore.cpp5
2 files changed, 11 insertions, 8 deletions
diff --git a/src/zenserver/projectstore/buildsremoteprojectstore.cpp b/src/zenserver/projectstore/buildsremoteprojectstore.cpp
index 0b0d8ccd0..b8b499f7f 100644
--- a/src/zenserver/projectstore/buildsremoteprojectstore.cpp
+++ b/src/zenserver/projectstore/buildsremoteprojectstore.cpp
@@ -255,7 +255,9 @@ public:
}
catch (const HttpClientError& Ex)
{
- Result.ErrorCode = Ex.m_Error != 0 ? Ex.m_Error : Ex.m_ResponseCode != HttpResponseCode::ImATeapot ? (int)Ex.m_ResponseCode : 0;
+ Result.ErrorCode = Ex.GetInternalErrorCode() != 0 ? Ex.GetInternalErrorCode()
+ : Ex.GetHttpResponseCode() != HttpResponseCode::ImATeapot ? (int)Ex.GetHttpResponseCode()
+ : 0;
Result.Reason = fmt::format("Failed finalizing oplog container build part to {}/{}/{}/{}/{}. Reason: '{}'",
m_Url,
m_Namespace,
@@ -284,9 +286,9 @@ public:
}
catch (const HttpClientError& Ex)
{
- Result.ErrorCode = Ex.m_Error != 0 ? Ex.m_Error
- : Ex.m_ResponseCode != HttpResponseCode::ImATeapot ? (int)Ex.m_ResponseCode
- : 0;
+ Result.ErrorCode = Ex.GetInternalErrorCode() != 0 ? Ex.GetInternalErrorCode()
+ : Ex.GetHttpResponseCode() != HttpResponseCode::ImATeapot ? (int)Ex.GetHttpResponseCode()
+ : 0;
Result.Reason = fmt::format("Failed finalizing oplog container build to {}/{}/{}/{}. Reason: '{}'",
m_Url,
m_Namespace,
@@ -452,7 +454,9 @@ public:
private:
static int MakeErrorCode(const HttpClientError& Ex)
{
- return Ex.m_Error != 0 ? Ex.m_Error : Ex.m_ResponseCode != HttpResponseCode::ImATeapot ? (int)Ex.m_ResponseCode : 0;
+ return Ex.GetInternalErrorCode() != 0 ? Ex.GetInternalErrorCode()
+ : Ex.GetHttpResponseCode() != HttpResponseCode::ImATeapot ? (int)Ex.GetHttpResponseCode()
+ : 0;
}
std::unique_ptr<BuildStorage::Statistics> m_BuildStorageStats;
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 262b35ea2..690f697d0 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -34,7 +34,6 @@
#include "zenremoteprojectstore.h"
ZEN_THIRD_PARTY_INCLUDES_START
-#include <cpr/cpr.h>
#include <tsl/robin_set.h>
#include <xxh3.h>
ZEN_THIRD_PARTY_INCLUDES_END
@@ -192,7 +191,7 @@ namespace {
return {nullptr, "Missing service url"};
}
- std::string Url = cpr::util::urlDecode(std::string(CloudServiceUrl));
+ std::string Url = UrlDecode(CloudServiceUrl);
std::string_view Namespace = Cloud["namespace"sv].AsString();
if (Namespace.empty())
{
@@ -302,7 +301,7 @@ namespace {
return {nullptr, "Missing service url"};
}
- std::string Url = cpr::util::urlDecode(std::string(BuildsServiceUrl));
+ std::string Url = UrlDecode(BuildsServiceUrl);
std::string_view Namespace = Builds["namespace"sv].AsString();
if (Namespace.empty())
{