| 1154 | } |
| 1155 | |
| 1156 | apr_status_t md_json_readf(md_json_t **pjson, apr_pool_t *p, const char *fpath) |
| 1157 | { |
| 1158 | apr_file_t *f; |
| 1159 | json_t *j; |
| 1160 | apr_status_t rv; |
| 1161 | json_error_t error; |
| 1162 | |
| 1163 | rv = apr_file_open(&f, fpath, APR_FOPEN_READ, 0, p); |
| 1164 | if (rv != APR_SUCCESS) { |
| 1165 | return rv; |
| 1166 | } |
| 1167 | |
| 1168 | j = json_load_callback(load_file_cb, f, 0, &error); |
| 1169 | if (j) { |
| 1170 | *pjson = json_create(p, j); |
| 1171 | } |
| 1172 | else { |
| 1173 | md_log_perror(MD_LOG_MARK, MD_LOG_ERR, 0, p, |
| 1174 | "failed to load JSON file %s: %s (line %d:%d)", |
| 1175 | fpath, error.text, error.line, error.column); |
| 1176 | } |
| 1177 | |
| 1178 | apr_file_close(f); |
| 1179 | return (j && *pjson) ? APR_SUCCESS : APR_EINVAL; |
| 1180 | } |
| 1181 | |
| 1182 | /**************************************************************************************************/ |
| 1183 | /* http get */ |
no test coverage detected