From 7d4c00c3e222c9712a3369b863fe8d4302bbe4c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= Date: Wed, 20 Mar 2024 17:33:46 +0000 Subject: [PATCH] CA-381119: use JsonRPC V2 for error replies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For regular replies we look at the request and reply with a matching version. However when we fail to parse the JsonRPC request itself then we don't know what version to use. XenCenter uses JsonRPC v2 by default, and JsonRPC v2 has been supported in XAPI for a long time. Signed-off-by: Edwin Török --- ocaml/xapi/api_server.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/xapi/api_server.ml b/ocaml/xapi/api_server.ml index a6016b5805b..711655148b3 100644 --- a/ocaml/xapi/api_server.ml +++ b/ocaml/xapi/api_server.ml @@ -346,7 +346,7 @@ let jsoncallback req bio _ = Http_svr.response_str req ~hdrs:[(Http.Hdr.content_type, "application/json")] fd - (Jsonrpc.string_of_response + (Jsonrpc.string_of_response ~version:Jsonrpc.V2 (Rpc.failure (Rpc.Enum (List.map (fun s -> Rpc.String s) (err :: params))) )