| 1993 | } |
| 1994 | |
| 1995 | AP_CORE_DECLARE(int) ap_parse_htaccess(ap_conf_vector_t **result, |
| 1996 | request_rec *r, int override, |
| 1997 | int override_opts, apr_table_t *override_list, |
| 1998 | const char *d, const char *access_names) |
| 1999 | { |
| 2000 | ap_configfile_t *f = NULL; |
| 2001 | cmd_parms parms; |
| 2002 | const char *filename; |
| 2003 | const struct htaccess_result *cache; |
| 2004 | struct htaccess_result *new; |
| 2005 | ap_conf_vector_t *dc = NULL; |
| 2006 | apr_status_t status; |
| 2007 | |
| 2008 | /* firstly, search cache */ |
| 2009 | for (cache = r->htaccess; cache != NULL; cache = cache->next) { |
| 2010 | if (cache->override == override && strcmp(cache->dir, d) == 0) { |
| 2011 | *result = cache->htaccess; |
| 2012 | return OK; |
| 2013 | } |
| 2014 | } |
| 2015 | |
| 2016 | parms = default_parms; |
| 2017 | parms.override = override; |
| 2018 | parms.override_opts = override_opts; |
| 2019 | parms.override_list = override_list; |
| 2020 | parms.pool = r->pool; |
| 2021 | parms.temp_pool = r->pool; |
| 2022 | parms.server = r->server; |
| 2023 | parms.path = apr_pstrdup(r->pool, d); |
| 2024 | |
| 2025 | /* loop through the access names and find the first one */ |
| 2026 | while (access_names[0]) { |
| 2027 | const char *access_name = ap_getword_conf(r->pool, &access_names); |
| 2028 | |
| 2029 | filename = NULL; |
| 2030 | status = ap_run_open_htaccess(r, d, access_name, &f, &filename); |
| 2031 | if (status == APR_SUCCESS) { |
| 2032 | const char *errmsg; |
| 2033 | ap_directive_t *temptree = NULL; |
| 2034 | |
| 2035 | dc = ap_create_per_dir_config(r->pool); |
| 2036 | |
| 2037 | parms.config_file = f; |
| 2038 | errmsg = ap_build_config(&parms, r->pool, r->pool, &temptree); |
| 2039 | if (errmsg == NULL) |
| 2040 | errmsg = ap_walk_config(temptree, &parms, dc); |
| 2041 | |
| 2042 | ap_cfg_closefile(f); |
| 2043 | |
| 2044 | if (errmsg) { |
| 2045 | ap_log_rerror(APLOG_MARK, APLOG_ALERT, 0, r, |
| 2046 | "%s: %s", filename, errmsg); |
| 2047 | return HTTP_INTERNAL_SERVER_ERROR; |
| 2048 | } |
| 2049 | |
| 2050 | *result = dc; |
| 2051 | break; |
| 2052 | } |
no test coverage detected