Skip to content

Commit 63a40d1

Browse files
authored
Check whether the "type" key in error responses is present (#411)
1 parent 7a06670 commit 63a40d1

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/md_acme.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,22 +182,24 @@ static apr_status_t inspect_problem(md_acme_req_t *req, const md_http_response_t
182182

183183
req->resp_json = problem;
184184
ptype = md_json_gets(problem, MD_KEY_TYPE, NULL);
185-
pdetail = md_json_gets(problem, MD_KEY_DETAIL, NULL);
186-
req->rv = problem_status_get(ptype);
187-
md_result_problem_set(req->result, req->rv, ptype, pdetail,
188-
md_json_getj(problem, MD_KEY_SUBPROBLEMS, NULL));
189-
190-
191-
192-
if (APR_STATUS_IS_EAGAIN(req->rv)) {
193-
md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, req->rv, req->p,
194-
"acme reports %s: %s", ptype, pdetail);
195-
}
196-
else {
197-
md_log_perror(MD_LOG_MARK, MD_LOG_WARNING, req->rv, req->p,
198-
"acme problem %s: %s", ptype, pdetail);
185+
186+
if (ptype) {
187+
req->rv = problem_status_get(ptype);
188+
pdetail = md_json_gets(problem, MD_KEY_DETAIL, NULL);
189+
190+
md_result_problem_set(req->result, req->rv, ptype, pdetail,
191+
md_json_getj(problem, MD_KEY_SUBPROBLEMS, NULL));
192+
193+
if (APR_STATUS_IS_EAGAIN(req->rv)) {
194+
md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, req->rv, req->p,
195+
"acme reports %s: %s", ptype, pdetail);
196+
}
197+
else {
198+
md_log_perror(MD_LOG_MARK, MD_LOG_WARNING, req->rv, req->p,
199+
"acme problem %s: %s", ptype, pdetail);
200+
}
201+
return req->rv;
199202
}
200-
return req->rv;
201203
}
202204
}
203205

0 commit comments

Comments
 (0)