summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorNick Kew <niq@apache.org>2012-01-09 05:01:06 +0100
committerNick Kew <niq@apache.org>2012-01-09 05:01:06 +0100
commite0ddfe0fdfd50acd20f597d0ad51e9104971f35b (patch)
treeb94325699402da344f19d4b3f169c9a6a675dfa9 /server
parentrewrite guesses URL or Filesystem in server context, but treats everything (diff)
downloadapache2-e0ddfe0fdfd50acd20f597d0ad51e9104971f35b.tar.xz
apache2-e0ddfe0fdfd50acd20f597d0ad51e9104971f35b.zip
Core configuration: add AllowOverride option to treat syntax
errors in .htaccess as non-fatal. PR 52439 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1229021 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/config.c34
-rw-r--r--server/core.c11
2 files changed, 38 insertions, 7 deletions
diff --git a/server/config.c b/server/config.c
index 409ca0695a..96ab9c9d57 100644
--- a/server/config.c
+++ b/server/config.c
@@ -848,8 +848,19 @@ static const char *invoke_cmd(const command_rec *cmd, cmd_parms *parms,
if(apr_table_get(parms->override_list, cmd->name) != NULL)
override_list_ok = 1;
- if ((parms->override & cmd->req_override) == 0 && !override_list_ok)
- return apr_pstrcat(parms->pool, cmd->name, " not allowed here", NULL);
+ if ((parms->override & cmd->req_override) == 0 && !override_list_ok) {
+ if (parms->override & NONFATAL_OVERRIDE) {
+ ap_log_perror(APLOG_MARK, APLOG_WARNING, 0, parms->temp_pool,
+ APLOGNO(02295)
+ "%s in .htaccess forbidden by AllowOverride",
+ cmd->name);
+ return NULL;
+ }
+ else {
+ return apr_pstrcat(parms->pool, cmd->name,
+ " not allowed here", NULL);
+ }
+ }
parms->info = cmd->cmd_data;
parms->cmd = cmd;
@@ -1251,11 +1262,20 @@ static const char *ap_walk_config_sub(const ap_directive_t *current,
if (ml == NULL) {
parms->err_directive = current;
- return apr_pstrcat(parms->pool, "Invalid command '",
- current->directive,
- "', perhaps misspelled or defined by a module "
- "not included in the server configuration",
- NULL);
+ if (parms->override & NONFATAL_UNKNOWN) {
+ ap_log_perror(APLOG_MARK, APLOG_WARNING, 0, parms->temp_pool,
+ APLOGNO(02296) "Unknown directive %s "
+ "perhaps misspelled or defined by a module "
+ "not included in the server configuration", dir);
+ return NULL;
+ }
+ else {
+ return apr_pstrcat(parms->pool, "Invalid command '",
+ current->directive,
+ "', perhaps misspelled or defined by a module "
+ "not included in the server configuration",
+ NULL);
+ }
}
for ( ; ml != NULL; ml = ml->next) {
diff --git a/server/core.c b/server/core.c
index b7d5ce31a6..eb8147b84c 100644
--- a/server/core.c
+++ b/server/core.c
@@ -1619,6 +1619,17 @@ static const char *set_override(cmd_parms *cmd, void *d_, const char *l)
else if (!strcasecmp(w, "Indexes")) {
d->override |= OR_INDEXES;
}
+ else if (!strcasecmp(w, "Nonfatal")) {
+ if (!strcasecmp(v, "Override")) {
+ d->override |= NONFATAL_OVERRIDE;
+ }
+ else if (!strcasecmp(v, "Unknown")) {
+ d->override |= NONFATAL_UNKNOWN;
+ }
+ else if (!strcasecmp(v, "All")) {
+ d->override |= NONFATAL_ALL;
+ }
+ }
else if (!strcasecmp(w, "None")) {
d->override = OR_NONE;
}