From 1d36bfaffcaeb1e38bf84fff5edda76ce5a51ba0 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Thu, 7 May 2015 21:29:34 +0100 Subject: [PATCH] Don't use chunked encoding for the RPC calls 1. it's not necessary 2. xapi doesn't understand it Signed-off-by: Jon Ludlam --- idl/xenvm_client.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/idl/xenvm_client.ml b/idl/xenvm_client.ml index 806d9b5..2698c38 100644 --- a/idl/xenvm_client.ml +++ b/idl/xenvm_client.ml @@ -21,14 +21,17 @@ module Rpc = struct (* Retry up to 5 times with 1s intervals *) let rpc call = - let body = Jsonrpc.string_of_call call |> Cohttp_lwt_body.of_string in + let body_str = Jsonrpc.string_of_call call in + let body = Cohttp_lwt_body.of_string body_str in let rec retry attempts_remaining last_exn = match attempts_remaining, last_exn with | 0, Some e -> fail e | _, _ -> begin Lwt.catch (fun () -> - Client.post (Uri.of_string !uri) ~body + let headers = Cohttp.Header.init () in + let headers = Cohttp.Header.add headers "content-length" (String.length body_str |> string_of_int) in + Client.post (Uri.of_string !uri) ~headers ~chunked:false ~body >>= fun x -> return (`Ok x)) (function