From f129d109a0396b09f775b24b0cae32ecc359fcb7 Mon Sep 17 00:00:00 2001 From: zapadi Date: Tue, 28 Mar 2023 08:58:11 +0200 Subject: [PATCH] Enabled schema set --- src/redmine-net-api/RedmineManager.cs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/redmine-net-api/RedmineManager.cs b/src/redmine-net-api/RedmineManager.cs index f89d8989..50bd7f60 100644 --- a/src/redmine-net-api/RedmineManager.cs +++ b/src/redmine-net-api/RedmineManager.cs @@ -105,7 +105,7 @@ public class RedmineManager : IRedmineManager public RedmineManager(string host, MimeFormat mimeFormat = MimeFormat.Xml, bool verifyServerCert = true, IWebProxy proxy = null, SecurityProtocolType securityProtocolType = default, string scheme = "https", TimeSpan? timeout = null) { - if (string.IsNullOrEmpty(host)) + if (host.IsNullOrWhiteSpace()) { throw new RedmineException("Host is not defined!"); } @@ -163,11 +163,12 @@ public RedmineManager(string host, MimeFormat mimeFormat = MimeFormat.Xml, bool /// if set to true [verify server cert]. /// The proxy. /// Use this parameter to specify a SecurityProtcolType. Note: it is recommended to leave this parameter at its default value as this setting also affects the calling application process. + /// /// The webclient timeout. Default is 100 seconds. public RedmineManager(string host, string apiKey, MimeFormat mimeFormat = MimeFormat.Xml, - bool verifyServerCert = true, IWebProxy proxy = null, - SecurityProtocolType securityProtocolType = default, TimeSpan? timeout = null) - : this(host, mimeFormat, verifyServerCert, proxy, securityProtocolType, timeout: timeout) + bool verifyServerCert = true, IWebProxy proxy = null, + SecurityProtocolType securityProtocolType = default, string scheme = "https", TimeSpan? timeout = null) + : this(host, mimeFormat, verifyServerCert, proxy, securityProtocolType, scheme, timeout: timeout) { ApiKey = apiKey; } @@ -193,11 +194,13 @@ public RedmineManager(string host, string apiKey, MimeFormat mimeFormat = MimeFo /// if set to true [verify server cert]. /// The proxy. /// Use this parameter to specify a SecurityProtcolType. Note: it is recommended to leave this parameter at its default value as this setting also affects the calling application process. + /// /// The webclient timeout. Default is 100 seconds. public RedmineManager(string host, string login, string password, MimeFormat mimeFormat = MimeFormat.Xml, - bool verifyServerCert = true, IWebProxy proxy = null, - SecurityProtocolType securityProtocolType = default, TimeSpan? timeout = null) - : this(host, mimeFormat, verifyServerCert, proxy, securityProtocolType, timeout: timeout) + bool verifyServerCert = true, IWebProxy proxy = null, + SecurityProtocolType securityProtocolType = default, string scheme = "https", TimeSpan? timeout = null) + : this(host, mimeFormat, verifyServerCert, proxy, securityProtocolType, scheme, timeout: timeout) + { cache = new CredentialCache { { new Uri(host), "Basic", new NetworkCredential(login, password) } }; @@ -244,6 +247,11 @@ private set if (Uri.TryCreate(host, UriKind.Absolute, out Uri uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps)) { + if (Scheme.IsNullOrWhiteSpace()) + { + Scheme = uriResult.Scheme; + } + return; }