aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/cache/cacherpc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenstore/cache/cacherpc.cpp')
-rw-r--r--src/zenstore/cache/cacherpc.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/zenstore/cache/cacherpc.cpp b/src/zenstore/cache/cacherpc.cpp
index 6cdfeabd0..ec045af2f 100644
--- a/src/zenstore/cache/cacherpc.cpp
+++ b/src/zenstore/cache/cacherpc.cpp
@@ -155,6 +155,7 @@ CacheRpcHandler::AreDiskWritesAllowed() const
CacheRpcHandler::RpcResponseCode
CacheRpcHandler::HandleRpcRequest(const CacheRequestContext& Context,
+ std::string_view UriNamespace,
const ZenContentType ContentType,
IoBuffer&& Body,
uint32_t& OutAcceptMagic,
@@ -191,10 +192,24 @@ CacheRpcHandler::HandleRpcRequest(const CacheRequestContext& Context,
return RpcResponseCode::BadRequest;
}
}
+
+ if (!UriNamespace.empty())
+ {
+ CbObjectView Params = Object["Params"sv].AsObjectView();
+ std::optional<std::string> ParamsNamespace = GetRpcRequestNamespace(Params);
+
+ if (ParamsNamespace)
+ {
+ if (UriNamespace != ParamsNamespace)
+ {
+ return RpcResponseCode::BadRequest;
+ }
+ }
+ }
}
catch (const std::invalid_argument& ex)
{
- ZEN_WARN("Invalid rpc message package recevied, reason: '{}'", ex.what());
+ ZEN_WARN("Invalid rpc message package received, reason: '{}'", ex.what());
return RpcResponseCode::BadRequest;
}
OutAcceptMagic = Object["Accept"sv].AsUInt32();