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

Function magic_find_ct

modules/metadata/mod_mime_magic.c:2411–2446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2409 */
2410
2411static int magic_find_ct(request_rec *r)
2412{
2413 int result;
2414 magic_server_config_rec *conf;
2415
2416 /* the file has to exist */
2417 if (r->finfo.filetype == APR_NOFILE || !r->filename) {
2418 return DECLINED;
2419 }
2420
2421 /* was someone else already here? */
2422 if (r->content_type) {
2423 return DECLINED;
2424 }
2425
2426 conf = ap_get_module_config(r->server->module_config, &mime_magic_module);
2427 if (!conf || !conf->magic) {
2428 return DECLINED;
2429 }
2430
2431 /* initialize per-request info */
2432 if (!magic_set_config(r)) {
2433 return HTTP_INTERNAL_SERVER_ERROR;
2434 }
2435
2436 /* try excluding file-revision suffixes */
2437 if (revision_suffix(r) != 1) {
2438 /* process it based on the file contents */
2439 if ((result = magic_process(r)) != OK) {
2440 return result;
2441 }
2442 }
2443
2444 /* if we have any results, put them in the request structure */
2445 return magic_rsl_to_request(r);
2446}
2447
2448static void register_hooks(apr_pool_t *p)
2449{

Callers

nothing calls this directly

Calls 5

ap_get_module_configFunction · 0.85
magic_set_configFunction · 0.85
revision_suffixFunction · 0.85
magic_processFunction · 0.85
magic_rsl_to_requestFunction · 0.85

Tested by

no test coverage detected