diff options
| author | Stefan Boberg <[email protected]> | 2021-09-06 19:07:37 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-06 19:07:37 +0200 |
| commit | e14340b63a36d07fb256c98c59d9f150a5693ce9 (patch) | |
| tree | 4cdbf6900bb822fd2e311079cad25ba2f54f778d /zenserver/upstream/jupiter.cpp | |
| parent | clang-format fixes (diff) | |
| parent | Support for switching between storing derived data using the legacy DDC endpo... (diff) | |
| download | zen-e14340b63a36d07fb256c98c59d9f150a5693ce9.tar.xz zen-e14340b63a36d07fb256c98c59d9f150a5693ce9.zip | |
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zenserver/upstream/jupiter.cpp')
| -rw-r--r-- | zenserver/upstream/jupiter.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/zenserver/upstream/jupiter.cpp b/zenserver/upstream/jupiter.cpp index 7e22b9af9..d204e8f0b 100644 --- a/zenserver/upstream/jupiter.cpp +++ b/zenserver/upstream/jupiter.cpp @@ -134,9 +134,10 @@ CloudCacheSession::GetDerivedData(std::string_view BucketId, const IoHash& Key) } CloudCacheResult -CloudCacheSession::GetRef(std::string_view BucketId, const IoHash& Key) +CloudCacheSession::GetRef(std::string_view BucketId, const IoHash& Key, ZenContentType RefType) { - std::string Auth; + const std::string ContentType = RefType == ZenContentType::kCbObject ? "application/x-ue-cb" : "application/octet-stream"; + std::string Auth; m_CacheClient->AcquireAccessToken(Auth); ExtendableStringBuilder<256> Uri; @@ -146,7 +147,7 @@ CloudCacheSession::GetRef(std::string_view BucketId, const IoHash& Key) cpr::Session& Session = m_SessionState->Session; Session.SetOption(cpr::Url{Uri.c_str()}); - Session.SetOption(cpr::Header{{"Authorization", Auth}, {"Accept", "application/x-ue-cb"}}); + Session.SetOption(cpr::Header{{"Authorization", Auth}, {"Accept", ContentType}}); cpr::Response Response = Session.Get(); detail::Log(m_Log, "GET"sv, Response); @@ -215,11 +216,12 @@ CloudCacheSession::PutDerivedData(std::string_view BucketId, const IoHash& Key, } CloudCacheResult -CloudCacheSession::PutRef(std::string_view BucketId, const IoHash& Key, IoBuffer Ref) +CloudCacheSession::PutRef(std::string_view BucketId, const IoHash& Key, IoBuffer Ref, ZenContentType RefType) { IoHash Hash = IoHash::HashBuffer(Ref.Data(), Ref.Size()); - std::string Auth; + const std::string ContentType = RefType == ZenContentType::kCbObject ? "application/x-ue-cb" : "application/octet-stream"; + std::string Auth; m_CacheClient->AcquireAccessToken(Auth); ExtendableStringBuilder<256> Uri; @@ -229,8 +231,7 @@ CloudCacheSession::PutRef(std::string_view BucketId, const IoHash& Key, IoBuffer cpr::Session& Session = m_SessionState->Session; Session.SetOption(cpr::Url{Uri.c_str()}); - Session.SetOption( - cpr::Header{{"Authorization", Auth}, {"X-Jupiter-IoHash", Hash.ToHexString()}, {"Content-Type", "application/x-ue-cb"}}); + Session.SetOption(cpr::Header{{"Authorization", Auth}, {"X-Jupiter-IoHash", Hash.ToHexString()}, {"Content-Type", ContentType}}); Session.SetBody(cpr::Body{(const char*)Ref.Data(), Ref.Size()}); cpr::Response Response = Session.Put(); |