ACMESharp.AcmeClient.RefreshCertificateRequest C# (CSharp) Метод

RefreshCertificateRequest() публичный Метод

public RefreshCertificateRequest ( ACMESharp.CertificateRequest certRequ, bool useRootUrl = false ) : void
certRequ ACMESharp.CertificateRequest
useRootUrl bool
Результат void
        public void RefreshCertificateRequest(CertificateRequest certRequ, bool useRootUrl = false)
        {
            AssertInit();
            AssertRegistration();

            var requUri = new Uri(certRequ.Uri);
            if (useRootUrl)
                requUri = new Uri(RootUrl, requUri.PathAndQuery);

            var acmeResp = RequestHttpGet(requUri);

            if (acmeResp.StatusCode != HttpStatusCode.OK && acmeResp.StatusCode != HttpStatusCode.Accepted)
                throw new AcmeProtocolException("Unexpected response status code", acmeResp);

            certRequ.StatusCode = acmeResp.StatusCode;
            certRequ.Links = acmeResp.Links;
            certRequ.SetCertificateContent(acmeResp.RawContent);
            certRequ.RetryAfter = null;

            var certContent = acmeResp.RawContent;
            var retryAfter = acmeResp.Headers[AcmeProtocol.HEADER_RETRY_AFTER];
            if (!string.IsNullOrEmpty(retryAfter))
            {
                // According to spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37)
                // this could be a number of seconds or a date, so we have to parse appropriately
                if (Regex.IsMatch(retryAfter, "[0-9]+"))
                {
                    certRequ.RetryAfter = DateTime.Now.AddSeconds(int.Parse(retryAfter));
                }
                else
                {
                    certRequ.RetryAfter = DateTime.Parse(retryAfter);
                }
            }
        }