From a86edc6cfd4faebec0b33b5b49ae5e718bd99be6 Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Wed, 18 Jul 2018 13:24:21 +0100 Subject: [PATCH] Copy some more properties of the XmlRpcProxy to the JsonRpcClient and ensure all JsonRpcCient properties are replicated when the session is duplicated. Signed-off-by: Konstantina Chremmou --- XenModel/XenAPI-Extensions/Session.cs | 11 ++++++++++- XenModel/XenAPI/JsonRpc.cs | 11 +++++++++++ XenModel/XenAPI/Session.cs | 7 ++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/XenModel/XenAPI-Extensions/Session.cs b/XenModel/XenAPI-Extensions/Session.cs index 8c25020ca..02e1895d4 100644 --- a/XenModel/XenAPI-Extensions/Session.cs +++ b/XenModel/XenAPI-Extensions/Session.cs @@ -83,7 +83,16 @@ namespace XenAPI JsonRpcClient = new JsonRpcClient(session.Url) { JsonRpcVersion = session.JsonRpcClient.JsonRpcVersion, - Timeout = timeout + Timeout = timeout, + ConnectionGroupName = session.JsonRpcClient.ConnectionGroupName, + KeepAlive = session.JsonRpcClient.KeepAlive, + UserAgent = session.JsonRpcClient.UserAgent, + WebProxy = session.JsonRpcClient.WebProxy, + ProtocolVersion = session.JsonRpcClient.ProtocolVersion, + Expect100Continue = session.JsonRpcClient.Expect100Continue, + AllowAutoRedirect = session.JsonRpcClient.AllowAutoRedirect, + PreAuthenticate = session.JsonRpcClient.PreAuthenticate, + Cookies = session.JsonRpcClient.Cookies }; JsonRpcClient.RequestEvent += LogJsonRequest; } diff --git a/XenModel/XenAPI/JsonRpc.cs b/XenModel/XenAPI/JsonRpc.cs index f8df8a885..c9db7114e 100755 --- a/XenModel/XenAPI/JsonRpc.cs +++ b/XenModel/XenAPI/JsonRpc.cs @@ -175,6 +175,11 @@ namespace XenAPI public IWebProxy WebProxy { get; set; } public int Timeout { get; set; } public string ConnectionGroupName { get; set; } + public Version ProtocolVersion { get; set; } + public bool Expect100Continue { get; set; } + public bool AllowAutoRedirect { get; set; } + public bool PreAuthenticate { get; set; } + public CookieContainer Cookies { get; set; } public string Url { get; private set; } @@ -197,6 +202,12 @@ namespace XenAPI webRequest.Method = "POST"; webRequest.ContentType = "application/json"; webRequest.Accept = "application/json"; + webRequest.ProtocolVersion = ProtocolVersion; + webRequest.ServicePoint.Expect100Continue = Expect100Continue; + webRequest.AllowAutoRedirect = AllowAutoRedirect; + webRequest.PreAuthenticate = PreAuthenticate; + webRequest.AllowWriteStreamBuffering = true; + webRequest.CookieContainer = Cookies; webRequest.Timeout = Timeout; webRequest.Proxy = WebProxy; webRequest.KeepAlive = KeepAlive; diff --git a/XenModel/XenAPI/Session.cs b/XenModel/XenAPI/Session.cs index 25aa8af72..2435274bb 100644 --- a/XenModel/XenAPI/Session.cs +++ b/XenModel/XenAPI/Session.cs @@ -417,7 +417,12 @@ namespace XenAPI Timeout = session.proxy.Timeout, KeepAlive = session.proxy.KeepAlive, UserAgent = session.proxy.UserAgent, - WebProxy = session.proxy.Proxy + WebProxy = session.proxy.Proxy, + ProtocolVersion = session.proxy.ProtocolVersion, + Expect100Continue = session.proxy.Expect100Continue, + AllowAutoRedirect = session.proxy.AllowAutoRedirect, + PreAuthenticate = session.proxy.PreAuthenticate, + Cookies = session.proxy.CookieContainer }; if (isInvernessOrAbove)