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

Function socache_status_hook

modules/cache/mod_cache_socache.c:1355–1410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1353}
1354
1355static int socache_status_hook(request_rec *r, int flags)
1356{
1357 apr_status_t status = APR_SUCCESS;
1358 cache_socache_conf *conf = ap_get_module_config(r->server->module_config,
1359 &cache_socache_module);
1360 if (!conf->provider || !conf->provider->socache_provider ||
1361 !conf->provider->socache_instance) {
1362 return DECLINED;
1363 }
1364
1365 if (!(flags & AP_STATUS_SHORT)) {
1366 ap_rputs("<hr>\n"
1367 "<table cellspacing=0 cellpadding=0>\n"
1368 "<tr><td bgcolor=\"#000000\">\n"
1369 "<b><font color=\"#ffffff\" face=\"Arial,Helvetica\">"
1370 "mod_cache_socache Status:</font></b>\n"
1371 "</td></tr>\n"
1372 "<tr><td bgcolor=\"#ffffff\">\n", r);
1373 }
1374 else {
1375 ap_rputs("ModCacheSocacheStatus\n", r);
1376 }
1377
1378 if (socache_mutex) {
1379 status = apr_global_mutex_lock(socache_mutex);
1380 if (status != APR_SUCCESS) {
1381 ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(02816)
1382 "could not acquire lock for cache status");
1383 }
1384 }
1385
1386 if (status != APR_SUCCESS) {
1387 if (!(flags & AP_STATUS_SHORT)) {
1388 ap_rputs("No cache status data available\n", r);
1389 }
1390 else {
1391 ap_rputs("NotAvailable\n", r);
1392 }
1393 } else {
1394 conf->provider->socache_provider->status(conf->provider->socache_instance,
1395 r, flags);
1396 }
1397
1398 if (socache_mutex && status == APR_SUCCESS) {
1399 status = apr_global_mutex_unlock(socache_mutex);
1400 if (status != APR_SUCCESS) {
1401 ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(02817)
1402 "could not release lock for cache status");
1403 }
1404 }
1405
1406 if (!(flags & AP_STATUS_SHORT)) {
1407 ap_rputs("</td></tr>\n</table>\n", r);
1408 }
1409 return OK;
1410}
1411
1412static void socache_status_register(apr_pool_t *p)

Callers

nothing calls this directly

Calls 2

ap_get_module_configFunction · 0.85
ap_rputsFunction · 0.85

Tested by

no test coverage detected