| 38 | */ |
| 39 | |
| 40 | apr_status_t ssl_scache_init(server_rec *s, apr_pool_t *p) |
| 41 | { |
| 42 | SSLModConfigRec *mc = myModConfig(s); |
| 43 | apr_status_t rv; |
| 44 | struct ap_socache_hints hints; |
| 45 | |
| 46 | /* The very first invocation of this function will be the |
| 47 | * post_config invocation during server startup; do nothing for |
| 48 | * this first (and only the first) time through, since the pool |
| 49 | * will be immediately cleared anyway. For every subsequent |
| 50 | * invocation, initialize the configured cache. */ |
| 51 | if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) |
| 52 | return APR_SUCCESS; |
| 53 | |
| 54 | #ifdef HAVE_OCSP_STAPLING |
| 55 | if (mc->stapling_cache) { |
| 56 | memset(&hints, 0, sizeof hints); |
| 57 | hints.avg_obj_size = 1500; |
| 58 | hints.avg_id_len = 20; |
| 59 | hints.expiry_interval = 300; |
| 60 | |
| 61 | rv = mc->stapling_cache->init(mc->stapling_cache_context, |
| 62 | "mod_ssl-staple", &hints, s, p); |
| 63 | if (rv) { |
| 64 | ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01872) |
| 65 | "Could not initialize stapling cache. Exiting."); |
| 66 | return ssl_die(s); |
| 67 | } |
| 68 | } |
| 69 | #endif |
| 70 | |
| 71 | /* |
| 72 | * Warn the user that he should use the session cache. |
| 73 | * But we can operate without it, of course. |
| 74 | */ |
| 75 | if (mc->sesscache == NULL) { |
| 76 | ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, APLOGNO(01873) |
| 77 | "Init: Session Cache is not configured " |
| 78 | "[hint: SSLSessionCache]"); |
| 79 | return APR_SUCCESS; |
| 80 | } |
| 81 | |
| 82 | memset(&hints, 0, sizeof hints); |
| 83 | hints.avg_obj_size = 150; |
| 84 | hints.avg_id_len = 30; |
| 85 | hints.expiry_interval = 30; |
| 86 | |
| 87 | rv = mc->sesscache->init(mc->sesscache_context, "mod_ssl-sess", &hints, s, p); |
| 88 | if (rv) { |
| 89 | ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01874) |
| 90 | "Could not initialize session cache. Exiting."); |
| 91 | return ssl_die(s); |
| 92 | } |
| 93 | |
| 94 | return APR_SUCCESS; |
| 95 | } |
| 96 | |
| 97 | void ssl_scache_kill(server_rec *s) |
no test coverage detected