MCPcopy Create free account
hub / github.com/apache/httpd / md_acme_create

Function md_acme_create

modules/md/md_acme.c:624–664  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622/* ACME setup */
623
624apr_status_t md_acme_create(md_acme_t **pacme, apr_pool_t *p, const char *url,
625 const char *proxy_url, const char *ca_file)
626{
627 md_acme_t *acme;
628 const char *err = NULL;
629 apr_status_t rv;
630 apr_uri_t uri_parsed;
631 size_t len;
632
633 if (!url) {
634 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, APR_EINVAL, p, "create ACME without url");
635 return APR_EINVAL;
636 }
637
638 if (APR_SUCCESS != (rv = md_util_abs_uri_check(p, url, &err))) {
639 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, rv, p, "invalid ACME uri (%s): %s", err, url);
640 return rv;
641 }
642
643 acme = apr_pcalloc(p, sizeof(*acme));
644 acme->url = url;
645 acme->p = p;
646 acme->user_agent = apr_psprintf(p, "%s mod_md/%s",
647 base_product, MOD_MD_VERSION);
648 acme->proxy_url = proxy_url? apr_pstrdup(p, proxy_url) : NULL;
649 acme->max_retries = 99;
650 acme->ca_file = ca_file;
651
652 if (APR_SUCCESS != (rv = apr_uri_parse(p, url, &uri_parsed))) {
653 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, rv, p, "parsing ACME uri: %s", url);
654 return APR_EINVAL;
655 }
656
657 len = strlen(uri_parsed.hostname);
658 acme->sname = (len <= 16)? uri_parsed.hostname : apr_pstrdup(p, uri_parsed.hostname + len - 16);
659 acme->version = MD_ACME_VERSION_UNKNOWN;
660 acme->last = md_result_make(acme->p, APR_SUCCESS);
661
662 *pacme = acme;
663 return rv;
664}
665
666typedef struct {
667 md_acme_t *acme;

Callers 3

acme_renewFunction · 0.85
acme_preloadFunction · 0.85
acme_get_ariFunction · 0.85

Calls 3

md_log_perrorFunction · 0.85
md_util_abs_uri_checkFunction · 0.85
md_result_makeFunction · 0.85

Tested by

no test coverage detected