httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1238698 - in /httpd/httpd/branches/2.4.x: CHANGES docs/manual/mod/core.xml include/ap_mmn.h include/http_config.h include/http_core.h server/config.c server/core.c
Date Tue, 31 Jan 2012 17:32:50 GMT
Author: jim
Date: Tue Jan 31 17:32:50 2012
New Revision: 1238698

URL: http://svn.apache.org/viewvc?rev=1238698&view=rev
Log:
Merge r1229021 from trunk:

Core configuration: add AllowOverride option to treat syntax
errors in .htaccess as non-fatal.
PR 52439


Submitted by: niq
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/docs/manual/mod/core.xml
    httpd/httpd/branches/2.4.x/include/ap_mmn.h
    httpd/httpd/branches/2.4.x/include/http_config.h
    httpd/httpd/branches/2.4.x/include/http_core.h
    httpd/httpd/branches/2.4.x/server/config.c
    httpd/httpd/branches/2.4.x/server/core.c

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1238698&r1=1238697&r2=1238698&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Tue Jan 31 17:32:50 2012
@@ -6,6 +6,9 @@ Changes with Apache 2.4.1
      when no custom ErrorDocument is specified for status code 400.  
      [Eric Covener]
 
+  *) Core configuration: add AllowOverride option to treat syntax
+     errors in .htaccess as non-fatal. PR 52439 [Nick Kew, Jim Jagielski]
+
   *) core: Fix memory consumption in core output filter with streaming
      bucket types like CGI or PIPE.  [Joe Orton, Stefan Fritsch]
 

Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/core.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/core.xml?rev=1238698&r1=1238697&r2=1238698&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/core.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/core.xml Tue Jan 31 17:32:50 2012
@@ -413,6 +413,11 @@ NoDecode option available in 2.3.12 and 
       module="mod_authz_host">Deny</directive> and <directive
       module="mod_authz_host">Order</directive>).</dd>
 
+      <dt>Nonfatal</dt>
+
+      <dd>
+      Allow use of AllowOverride option to treat syntax errors in .htaccess as non-fatal.</dt>
+
       <dt>Options[=<var>Option</var>,...]</dt>
 
       <dd>

Modified: httpd/httpd/branches/2.4.x/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/ap_mmn.h?rev=1238698&r1=1238697&r2=1238698&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.4.x/include/ap_mmn.h Tue Jan 31 17:32:50 2012
@@ -383,12 +383,13 @@
  *                         ap_proxy_sec2hex(), ap_proxy_make_fake_req(),
  *                         ap_proxy_strmatch_path, ap_proxy_strmatch_domain,
  *                         ap_proxy_table_unmerge(), proxy_lb_workers.
+ * 20120109.0 (2.4.1-dev)  Changes sizeof(overrides_t) in core config.
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20111203
+#define MODULE_MAGIC_NUMBER_MAJOR 20120109
 #endif
 #define MODULE_MAGIC_NUMBER_MINOR 0                   /* 0...n */
 

Modified: httpd/httpd/branches/2.4.x/include/http_config.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/http_config.h?rev=1238698&r1=1238697&r2=1238698&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/http_config.h (original)
+++ httpd/httpd/branches/2.4.x/include/http_config.h Tue Jan 31 17:32:50 2012
@@ -242,6 +242,13 @@ struct command_struct {
 #define EXEC_ON_READ 256     /**< force directive to execute a command
                 which would modify the configuration (like including another
                 file, or IFModule */
+/* Flags to determine whether syntax errors in .htaccess should be
+ * treated as nonfatal (log and ignore errors)
+ */
+#define NONFATAL_OVERRIDE 512    /* Violation of AllowOverride rule */
+#define NONFATAL_UNKNOWN 1024    /* Unrecognised directive */
+#define NONFATAL_ALL (NONFATAL_OVERRIDE|NONFATAL_UNKNOWN)
+
 /** this directive can be placed anywhere */
 #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
 

Modified: httpd/httpd/branches/2.4.x/include/http_core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/http_core.h?rev=1238698&r1=1238697&r2=1238698&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/http_core.h (original)
+++ httpd/httpd/branches/2.4.x/include/http_core.h Tue Jan 31 17:32:50 2012
@@ -446,7 +446,7 @@ AP_DECLARE(void **) ap_get_request_note(
 
 
 typedef unsigned char allow_options_t;
-typedef unsigned char overrides_t;
+typedef unsigned int overrides_t;
 
 /*
  * Bits of info that go into making an ETag for a file

Modified: httpd/httpd/branches/2.4.x/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/config.c?rev=1238698&r1=1238697&r2=1238698&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/config.c (original)
+++ httpd/httpd/branches/2.4.x/server/config.c Tue Jan 31 17:32:50 2012
@@ -848,8 +848,19 @@ static const char *invoke_cmd(const comm
          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(co
 
     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) {

Modified: httpd/httpd/branches/2.4.x/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/core.c?rev=1238698&r1=1238697&r2=1238698&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/core.c (original)
+++ httpd/httpd/branches/2.4.x/server/core.c Tue Jan 31 17:32:50 2012
@@ -1619,6 +1619,17 @@ static const char *set_override(cmd_parm
         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;
         }



Mime
View raw message