diff options
| author | Stefan Boberg <[email protected]> | 2026-03-27 12:03:02 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-27 12:03:02 +0100 |
| commit | fa3b5090e94ee1386ca6ed6c4ddf886fa46dca54 (patch) | |
| tree | c574405fc12dd2af9fcb02353df10adb29587f6c /src/zenhttp/include | |
| parent | idle deprovision in hub (#895) (diff) | |
| download | zen-fa3b5090e94ee1386ca6ed6c4ddf886fa46dca54.tar.xz zen-fa3b5090e94ee1386ca6ed6c4ddf886fa46dca54.zip | |
remove CPR HTTP client backend (#894)
CPR is no longer needed now that HttpClient has fully transitioned to raw libcurl. This removes the CPR library, its build integration, implementation files, and all conditional compilation guards, leaving curl as the sole HTTP client backend.
Diffstat (limited to 'src/zenhttp/include')
| -rw-r--r-- | src/zenhttp/include/zenhttp/cprutils.h | 98 | ||||
| -rw-r--r-- | src/zenhttp/include/zenhttp/httpclient.h | 3 |
2 files changed, 0 insertions, 101 deletions
diff --git a/src/zenhttp/include/zenhttp/cprutils.h b/src/zenhttp/include/zenhttp/cprutils.h deleted file mode 100644 index 3cfe652c5..000000000 --- a/src/zenhttp/include/zenhttp/cprutils.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -#pragma once - -#if ZEN_WITH_CPR - -# include <zencore/compactbinary.h> -# include <zencore/compactbinaryvalidation.h> -# include <zencore/iobuffer.h> -# include <zencore/string.h> -# include <zenhttp/formatters.h> -# include <zenhttp/httpclient.h> -# include <zenhttp/httpcommon.h> - -ZEN_THIRD_PARTY_INCLUDES_START -# include <cpr/response.h> -# include <fmt/format.h> -ZEN_THIRD_PARTY_INCLUDES_END - -template<> -struct fmt::formatter<cpr::Response> -{ - constexpr auto parse(format_parse_context& Ctx) -> decltype(Ctx.begin()) { return Ctx.end(); } - - template<typename FormatContext> - auto format(const cpr::Response& Response, FormatContext& Ctx) const -> decltype(Ctx.out()) - { - using namespace std::literals; - - if (Response.error) - { - return fmt::format_to(Ctx.out(), - "Failed: Url: {}, Reason: ({}) '{}'", - Response.url.str(), - int(Response.error.code), - Response.error.message); - } - else - { - const zen::NiceTimeSpanMs NiceResponseTime(uint64_t(Response.elapsed * 1000)); - - if (zen::IsHttpSuccessCode(Response.status_code)) - { - return fmt::format_to(Ctx.out(), - "OK: Url: {}, Status: ({}) '{}', Bytes: {}/{} (Up/Down), Elapsed: {}", - Response.url.str(), - Response.status_code, - zen::ToString(zen::HttpResponseCode(Response.status_code)), - Response.uploaded_bytes, - Response.downloaded_bytes, - NiceResponseTime.c_str()); - } - else - { - const auto It = Response.header.find("Content-Type"); - const std::string_view ContentType = It != Response.header.end() ? It->second : "<None>"sv; - - if (ContentType == "application/x-ue-cb"sv) - { - zen::IoBuffer Body(zen::IoBuffer::Wrap, Response.text.data(), Response.text.size()); - zen::CbObjectView Obj(Body.Data()); - zen::ExtendableStringBuilder<256> Sb; - std::string_view Json = Obj.ToJson(Sb).ToView(); - - return fmt::format_to( - Ctx.out(), - "Failed: Url: {}, Status: ({}) '{}', Reason: '{}'. Bytes: {}/{} (Up/Down), Elapsed: {}, Response: '{}'", - Response.url.str(), - Response.status_code, - zen::ToString(zen::HttpResponseCode(Response.status_code)), - Response.reason, - Response.uploaded_bytes, - Response.downloaded_bytes, - NiceResponseTime.c_str(), - Json); - } - else - { - zen::BodyLogFormatter Body(Response.text); - - return fmt::format_to( - Ctx.out(), - "Failed: Url: {}, Status: ({}) '{}', Reason: '{}'. Bytes: {}/{} (Up/Down), Elapsed: {}, Response: '{}'", - Response.url.str(), - Response.status_code, - zen::ToString(zen::HttpResponseCode(Response.status_code)), - Response.reason, - Response.uploaded_bytes, - Response.downloaded_bytes, - NiceResponseTime.c_str(), - Body.GetText()); - } - } - } - } -}; - -#endif // ZEN_WITH_CPR diff --git a/src/zenhttp/include/zenhttp/httpclient.h b/src/zenhttp/include/zenhttp/httpclient.h index 26d60b9ae..e199b700f 100644 --- a/src/zenhttp/include/zenhttp/httpclient.h +++ b/src/zenhttp/include/zenhttp/httpclient.h @@ -52,9 +52,6 @@ enum class HttpClientErrorCode : int enum class HttpClientBackend : uint8_t { kDefault, -#if ZEN_WITH_CPR - kCpr, -#endif kCurl, }; |