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

Function csr_req

modules/md/md_acme_drive.c:298–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298static apr_status_t csr_req(md_acme_t *acme, const md_http_response_t *res, void *baton)
299{
300 md_proto_driver_t *d = baton;
301 md_acme_driver_t *ad = d->baton;
302 const char *location;
303 md_cert_t *cert;
304 apr_status_t rv = APR_SUCCESS;
305
306 (void)acme;
307 location = apr_table_get(res->headers, "location");
308 if (!location)
309 return rv;
310
311 md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, 0, d->p,
312 "cert created with location header (old ACMEv1 style)");
313 ad->order->certificate = apr_pstrdup(d->p, location);
314 if (APR_SUCCESS != (rv = md_acme_order_save(d->store, d->p, MD_SG_STAGING,
315 d->md->name, ad->order, 0))) {
316 md_log_perror(MD_LOG_MARK, MD_LOG_ERR, APR_EINVAL, d->p,
317 "%s: saving cert url %s", d->md->name, location);
318 return rv;
319 }
320
321 /* Check if it already was sent with this response */
322 ad->chain_up_link = NULL;
323 if (APR_SUCCESS == (rv = md_cert_read_http(&cert, d->p, res))) {
324 md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, d->p, "cert parsed");
325 apr_array_clear(ad->cred->chain);
326 APR_ARRAY_PUSH(ad->cred->chain, md_cert_t*) = cert;
327 get_up_link(d, res->headers);
328 }
329 else if (APR_STATUS_IS_ENOENT(rv)) {
330 rv = APR_SUCCESS;
331 if (location) {
332 md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, d->p,
333 "cert not in response, need to poll %s", location);
334 }
335 }
336
337 return rv;
338}
339
340/**
341 * Pre-Req: all domains have been validated by the ACME server, e.g. all have AUTHZ

Callers

nothing calls this directly

Calls 4

md_log_perrorFunction · 0.85
md_acme_order_saveFunction · 0.85
md_cert_read_httpFunction · 0.85
get_up_linkFunction · 0.85

Tested by

no test coverage detected