| 813 | } |
| 814 | |
| 815 | static apr_status_t next_todo(md_http_request_t **preq, void *baton, |
| 816 | md_http_t *http, int in_flight) |
| 817 | { |
| 818 | md_ocsp_todo_ctx_t *ctx = baton; |
| 819 | md_ocsp_update_t *update, **pupdate; |
| 820 | md_ocsp_status_t *ostat; |
| 821 | md_http_request_t *req = NULL; |
| 822 | apr_status_t rv = APR_ENOENT; |
| 823 | apr_table_t *headers; |
| 824 | |
| 825 | if (in_flight < ctx->max_parallel) { |
| 826 | pupdate = apr_array_pop(ctx->todos); |
| 827 | if (pupdate) { |
| 828 | update = *pupdate; |
| 829 | ostat = update->ostat; |
| 830 | |
| 831 | update->job = md_ocsp_job_make(ctx->reg, ostat->md_name, update->p); |
| 832 | md_job_load(update->job); |
| 833 | md_job_start_run(update->job, update->result, ctx->reg->store); |
| 834 | |
| 835 | if (!ostat->ocsp_req) { |
| 836 | rv = ocsp_req_make(&ostat->ocsp_req, ostat->certid); |
| 837 | if (APR_SUCCESS != rv) goto cleanup; |
| 838 | } |
| 839 | if (0 == ostat->req_der.len) { |
| 840 | rv = ocsp_req_assign_der(&ostat->req_der, ostat->ocsp_req); |
| 841 | if (APR_SUCCESS != rv) goto cleanup; |
| 842 | } |
| 843 | md_result_activity_printf(update->result, "status of certid %s, " |
| 844 | "contacting %s", ostat->hexid, ostat->responder_url); |
| 845 | headers = apr_table_make(ctx->ptemp, 5); |
| 846 | apr_table_set(headers, "Expect", ""); |
| 847 | rv = md_http_POSTd_create(&req, http, ostat->responder_url, headers, |
| 848 | "application/ocsp-request", &ostat->req_der); |
| 849 | if (APR_SUCCESS != rv) goto cleanup; |
| 850 | md_http_set_on_status_cb(req, ostat_on_req_status, update); |
| 851 | md_http_set_on_response_cb(req, ostat_on_resp, update); |
| 852 | rv = APR_SUCCESS; |
| 853 | md_log_perror(MD_LOG_MARK, MD_LOG_TRACE2, 0, req->pool, |
| 854 | "scheduling OCSP request[%d] for %s, %d request in flight", |
| 855 | req->id, ostat->md_name, in_flight); |
| 856 | } |
| 857 | } |
| 858 | cleanup: |
| 859 | *preq = (APR_SUCCESS == rv)? req : NULL; |
| 860 | return rv; |
| 861 | } |
| 862 | |
| 863 | static int select_updates(void *baton, const void *key, apr_ssize_t klen, const void *val) |
| 864 | { |
nothing calls this directly
no test coverage detected