| 893 | } |
| 894 | |
| 895 | void md_ocsp_renew(md_ocsp_reg_t *reg, apr_pool_t *p, apr_pool_t *ptemp, apr_time_t *pnext_run) |
| 896 | { |
| 897 | md_ocsp_todo_ctx_t ctx; |
| 898 | md_http_t *http; |
| 899 | apr_status_t rv = APR_SUCCESS; |
| 900 | |
| 901 | (void)p; |
| 902 | (void)pnext_run; |
| 903 | |
| 904 | ctx.reg = reg; |
| 905 | ctx.ptemp = ptemp; |
| 906 | ctx.todos = apr_array_make(ptemp, (int)md_ocsp_count(reg), sizeof(md_ocsp_status_t*)); |
| 907 | ctx.max_parallel = 6; /* the magic number in HTTP */ |
| 908 | |
| 909 | /* Create a list of update tasks that are needed now or in the next minute */ |
| 910 | ctx.time = apr_time_now() + apr_time_from_sec(60);; |
| 911 | apr_hash_do(select_updates, &ctx, reg->ostat_by_id); |
| 912 | md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, 0, p, |
| 913 | "OCSP status updates due: %d", ctx.todos->nelts); |
| 914 | if (!ctx.todos->nelts) goto cleanup; |
| 915 | |
| 916 | rv = md_http_create(&http, ptemp, reg->user_agent, reg->proxy_url); |
| 917 | if (APR_SUCCESS != rv) goto cleanup; |
| 918 | |
| 919 | md_http_set_response_limit(http, MD_OCSP_MAX_RESPONSE_LEN); |
| 920 | md_http_set_timeout_default(http, MD_OCSP_DEFAULT_TIMEOUT); |
| 921 | md_http_set_connect_timeout_default(http, MD_OCSP_CONNECT_TIMEOUT); |
| 922 | md_http_set_stalling_default(http, MD_OCSP_STALLING_BYTES, |
| 923 | MD_OCSP_STALLING_TIME); |
| 924 | |
| 925 | rv = md_http_multi_perform(http, next_todo, &ctx); |
| 926 | |
| 927 | cleanup: |
| 928 | /* When do we need to run next? *pnext_run contains the planned schedule from |
| 929 | * the watchdog. We can make that earlier if we need it. */ |
| 930 | ctx.time = *pnext_run; |
| 931 | apr_hash_do(select_next_run, &ctx, reg->ostat_by_id); |
| 932 | |
| 933 | /* sanity check and return */ |
| 934 | if (ctx.time < apr_time_now()) ctx.time = apr_time_now() + apr_time_from_sec(1); |
| 935 | *pnext_run = ctx.time; |
| 936 | |
| 937 | if (APR_SUCCESS != rv && APR_ENOENT != rv) { |
| 938 | md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, p, "ocsp_renew done"); |
| 939 | } |
| 940 | return; |
| 941 | } |
| 942 | |
| 943 | apr_status_t md_ocsp_remove_responses_older_than(md_ocsp_reg_t *reg, apr_pool_t *p, |
| 944 | apr_time_t timestamp) |
no test coverage detected