| 2409 | */ |
| 2410 | |
| 2411 | static 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 | |
| 2448 | static void register_hooks(apr_pool_t *p) |
| 2449 | { |
nothing calls this directly
no test coverage detected