| 158 | } |
| 159 | |
| 160 | struct md_json_t *md_result_to_json(const md_result_t *result, apr_pool_t *p) |
| 161 | { |
| 162 | md_json_t *json; |
| 163 | char ts[APR_RFC822_DATE_LEN]; |
| 164 | |
| 165 | json = md_json_create(p); |
| 166 | md_json_setl(result->status, json, MD_KEY_STATUS, NULL); |
| 167 | if (result->status > 0) { |
| 168 | char buffer[HUGE_STRING_LEN]; |
| 169 | apr_strerror(result->status, buffer, sizeof(buffer)); |
| 170 | md_json_sets(buffer, json, "status-description", NULL); |
| 171 | } |
| 172 | if (result->problem) md_json_sets(result->problem, json, MD_KEY_PROBLEM, NULL); |
| 173 | if (result->detail) md_json_sets(result->detail, json, MD_KEY_DETAIL, NULL); |
| 174 | if (result->activity) md_json_sets(result->activity, json, MD_KEY_ACTIVITY, NULL); |
| 175 | if (result->ready_at > 0) { |
| 176 | apr_rfc822_date(ts, result->ready_at); |
| 177 | md_json_sets(ts, json, MD_KEY_VALID_FROM, NULL); |
| 178 | } |
| 179 | if (result->subproblems) { |
| 180 | md_json_setj(result->subproblems, json, MD_KEY_SUBPROBLEMS, NULL); |
| 181 | } |
| 182 | return json; |
| 183 | } |
| 184 | |
| 185 | static int str_cmp(const char *s1, const char *s2) |
| 186 | { |
no test coverage detected