httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject [PATCH] Fix a few minor inconsistencies related to directive scoping
Date Tue, 15 Dec 1998 16:41:54 GMT

Fix a few minor inconsistencies related to directive scoping
============================================================

1. httpd -h

Under "httpd -h" one gets a nice English description in which scope a
directive can occur. But we talk here only about <Directory> and <Location>,
although <Files> is treated the same (also with `cmd->override ==
ACCESS_CONF|OR_ALL'). So I think it's correct to also list <Files>, too.

2. Used scope variants

Currently we have 203 directives and they use the following scopes (the
numbers in parenthesis gives the number of directives using a particular
scope):

   RSRC_CONF (106)
   RSRC_CONF|ACCESS_CONF (5)
   RSRC_CONF|ACCESS_CONF|OR_ALL (1)            <--
   RSRC_CONF|ACCESS_CONF|OR_AUTHCFG (2)        <--
   ACCESS_CONF (5)
   OR_AUTHCFG (20)
   OR_LIMIT (3)
   OR_OPTIONS (4)
   OR_FILEINFO (21)
   OR_INDEXES (23)
   OR_ALL (13)

This is well spreaded and sounds reasonable. Except for
the two classes:

   RSRC_CONF|ACCESS_CONF|OR_ALL (1)            
   RSRC_CONF|ACCESS_CONF|OR_AUTHCFG (2)       

The first one is just a syntax overkill. It means only OR_ALL, because OR_ALL
includes (implicitly) already RSRC_CONF and ACCESS_CONF. So, when we fix
this to OR_ALL we get:

   RSRC_CONF (106)
   RSRC_CONF|ACCESS_CONF (5)
   RSRC_CONF|ACCESS_CONF|OR_AUTHCFG (2)        <--
   ACCESS_CONF (5)
   OR_AUTHCFG (20)
   OR_LIMIT (3)
   OR_OPTIONS (4)
   OR_FILEINFO (21)
   OR_INDEXES (23)
   OR_ALL (14)

The remaining RSRC_CONF|ACCESS_CONF|OR_AUTHCFG is used by two directives:
UseCanonicalName and ContentDigest. Two not too old directives which were
added mostly at the same time. They're are implemented the same way.
But the scope looks incorrect. Why?

First, it's again syntax overkill, ok. We can reduce it to
RSRC_CONF|OR_AUTHCFG. But when we compare it to all other used scopes, it
looks very inconsistent. No other of the 203 directives want to be applicable
in such a non-orthoginal scope: on the first hand inside the AuthConfig scope
(which means .htaccess under "AllowOverride AuthConfig" plus _INSIDE_ of
<Directory>/<Location>/<Files> sections in httpd.conf only) and on the other
hand also in RSRC_CONF (which means _OUTSIDE_ of
<Directory>/<Location>/<Files> sections in httpd.conf only). Sure, finally
it's everywhere in httpd.conf plus .htaccess under AuthConfig scope.  But it's
not intuitive: Directives which want to be applicable in such a total scope
use OR_OPTIONS, OR_FILEINFO or OR_INDEXES. And when we think about
UseCanonicalName and ContentDigest we find out that they belongs more to
Options, XBitHack and CheckSpelling than to any AuthXXXX directives.

So, I propose to change the scope of those two directives to OR_OPTIONS.  It
makes no big difference, of course. It still is useable everwhere inside
httpd.conf, but inside .htaccess now under Options instead of AuthConfig.  And
it both belongs to the more correct group of directives and makes our list of
used scopes more consistent.

With the above patch be get this consistent scope-list:

   RSRC_CONF (106)
   RSRC_CONF|ACCESS_CONF (5)
   ACCESS_CONF (5)
   OR_AUTHCFG (20)
   OR_LIMIT (3)
   OR_OPTIONS (6)
   OR_FILEINFO (21)
   OR_INDEXES (23)
   OR_ALL (14)

When we take into account that _theoretically_ there are a lot more variants
of these or'ed values are possible, this list is _VERY_ clean. Actually it's
the most clean variant I can think of (except for the fact that the whole
mechanism is a horrible mess ;-)...

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Index: src/CHANGES
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/CHANGES,v
retrieving revision 1.1170
diff -u -r1.1170 CHANGES
--- src/CHANGES	1998/12/12 05:26:00	1.1170
+++ src/CHANGES	1998/12/15 16:37:04
@@ -1,5 +1,10 @@
 Changes with Apache 1.3.4
 
+  *) Fix some inconsistencies related to the scopes of directives. The only
+     user visible change is that the directives `UseCanonicalName' and
+     `ContentDigest' now use the (more correct) `Options' scope instead of
+     (less correct) `AuthConfig' scope.  [Ralf S. Engelschall]
+
   *) Added two new core API functions, ap_single_module_configure() and
      ap_single_module_init(), which are now used by mod_so to correctly
      initialize a module after loading. This fixes a problem with unusable
Index: src/main/http_config.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/main/http_config.c,v
retrieving revision 1.137
diff -u -r1.137 http_config.c
--- src/main/http_config.c	1998/12/12 05:26:03	1.137
+++ src/main/http_config.c	1998/12/15 16:11:44
@@ -1557,9 +1557,9 @@
 	 ((pc->req_override & (ACCESS_CONF | OR_AUTHCFG | OR_LIMIT)))))
 	printf("anywhere");
     else if (pc->req_override & RSRC_CONF)
-	printf("only outside <Directory> or <Location>");
+	printf("only outside <Directory>, <Files> or <Location>");
     else
-	printf("only inside <Directory> or <Location>");
+	printf("only inside <Directory>, <Files> or <Location>");
 
     /* Warn if the directive is allowed inside <Directory> or .htaccess
      * but module doesn't support per-dir configuration */
Index: src/main/http_core.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/main/http_core.c,v
retrieving revision 1.241
diff -u -r1.241 http_core.c
--- src/main/http_core.c	1998/11/20 21:17:28	1.241
+++ src/main/http_core.c	1998/12/15 16:11:49
@@ -2584,10 +2584,10 @@
   "Whether persistent connections should be On or Off" },
 { "IdentityCheck", set_idcheck, NULL, RSRC_CONF|ACCESS_CONF, FLAG,
   "Enable identd (RFC 1413) user lookups - SLOW" },
-{ "ContentDigest", set_content_md5, NULL, RSRC_CONF|ACCESS_CONF|OR_AUTHCFG,
+{ "ContentDigest", set_content_md5, NULL, OR_OPTIONS,
   FLAG, "whether or not to send a Content-MD5 header with each request" },
 { "UseCanonicalName", set_use_canonical_name, NULL,
-  RSRC_CONF|ACCESS_CONF|OR_AUTHCFG, FLAG,
+  OR_OPTIONS, FLAG,
   "Whether or not to always use the canonical ServerName : Port when "
   "constructing URLs" },
 { "StartServers", set_daemons_to_start, NULL, RSRC_CONF, TAKE1,
@@ -2664,7 +2664,7 @@
   "Limit (0 = unlimited) on max number of header fields in a request message"},
 { "LimitRequestBody", set_limit_req_body,
   (void*)XtOffsetOf(core_dir_config, limit_req_body),
-  RSRC_CONF|ACCESS_CONF|OR_ALL, TAKE1,
+  OR_ALL, TAKE1,
   "Limit (in bytes) on maximum size of request message body" },
 { NULL },
 };
Index: htdocs/manual/mod/core.html
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/htdocs/manual/mod/core.html,v
retrieving revision 1.141
diff -u -r1.141 core.html
--- htdocs/manual/mod/core.html	1998/11/23 15:21:18	1.141
+++ htdocs/manual/mod/core.html	1998/12/15 16:27:11
@@ -445,7 +445,7 @@
 <A
  HREF="directive-dict.html#Override"
  REL="Help"
-><STRONG>Override:</STRONG></A> AuthConfig<BR>
+><STRONG>Override:</STRONG></A> Options<BR>
 <A
  HREF="directive-dict.html#Status"
  REL="Help"
@@ -3006,7 +3006,7 @@
 <STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess
 <BR>
 <A HREF="directive-dict.html#Override" REL="Help">
-<STRONG>Override:</STRONG></A> AuthConfig<BR>
+<STRONG>Override:</STRONG></A> Options<BR>
 <A HREF="directive-dict.html#Compatibility" REL="Help">
 <STRONG>Compatibility:</STRONG></A> UseCanonicalName is only available
in
 Apache 1.3 and later<P>

Mime
View raw message