| 63 | /* life cycle */ |
| 64 | |
| 65 | static apr_status_t load_props(md_reg_t *reg, apr_pool_t *p) |
| 66 | { |
| 67 | md_json_t *json; |
| 68 | apr_status_t rv; |
| 69 | |
| 70 | rv = md_store_load(reg->store, MD_SG_NONE, NULL, MD_FN_HTTPD_JSON, |
| 71 | MD_SV_JSON, (void**)&json, p); |
| 72 | if (APR_SUCCESS == rv) { |
| 73 | if (md_json_has_key(json, MD_KEY_PROTO, MD_KEY_HTTP, NULL)) { |
| 74 | reg->can_http = md_json_getb(json, MD_KEY_PROTO, MD_KEY_HTTP, NULL); |
| 75 | } |
| 76 | if (md_json_has_key(json, MD_KEY_PROTO, MD_KEY_HTTPS, NULL)) { |
| 77 | reg->can_https = md_json_getb(json, MD_KEY_PROTO, MD_KEY_HTTPS, NULL); |
| 78 | } |
| 79 | } |
| 80 | else if (APR_STATUS_IS_ENOENT(rv)) { |
| 81 | rv = APR_SUCCESS; |
| 82 | } |
| 83 | else { |
| 84 | apr_status_t rv2; |
| 85 | md_log_perror(MD_LOG_MARK, MD_LOG_INFO, 0, p, |
| 86 | "removing md/%s on error loading it", MD_FN_HTTPD_JSON); |
| 87 | rv2 = md_store_remove(reg->store, MD_SG_NONE, NULL, MD_FN_HTTPD_JSON, |
| 88 | p, TRUE); |
| 89 | if (rv2 != APR_SUCCESS) |
| 90 | md_log_perror(MD_LOG_MARK, MD_LOG_ERR, APR_EINVAL, p, |
| 91 | "error removing md/%s", MD_FN_HTTPD_JSON); |
| 92 | else |
| 93 | rv = APR_SUCCESS; |
| 94 | } |
| 95 | return rv; |
| 96 | } |
| 97 | |
| 98 | apr_status_t md_reg_create(md_reg_t **preg, apr_pool_t *p, struct md_store_t *store, |
| 99 | const char *proxy_url, const char *ca_file, |
no test coverage detected