You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Andrew Wilson <an...@www.elsevier.co.uk> on 1995/08/14 13:40:28 UTC

(FYI) ErrorDocument defined in .htaccess 0.8.8

Darn,
	missed ANOTHER patch round!  Ok, this is a patch against 0.8.8
which adds more bits to the overrides mask used to determine which
configuration directives can appear where (in access.conf, srm.conf, .htaccess).

This patch against 0.8.8 extends the number of overridable options
from 8 to 16 by increasing the override mask to 16-bits, from int to long.

This is really two patches, the second makes use of the extended bitmap
and allows .htaccess files to override the ErrorDocument directive.  This
option is *really* useful if you're running web site as a development environment, which several different teams are playing with.  Everyone wants to be able to
define their own error handling code, and this lets them do it without the need to
share a single big handler cgi-bin script.

With the patch applied you can put the following in your access.conf:

	AllowOverrides Errors

And the following will be able to appear in any .htaccess file:

	ErrorDocument 404 /cgi-bin/errors.cgi

We now have a different ErrorDocument set available for each set of
pages protected by a .htaccess.  If you're running a site with many essentially
separate cgi applications this makes things a LOT easier to manage.

Rob T complains that we've also run out of bit-space for OPT_ions and other
flaggery, so I guess the same approach is applicable for these too.

But anyway, fukkit.  I'll roll up another for 0.8.9 and people can vote on it.

Ay.


--- cut here ---


*** http_config.h.dist	Sat Aug 12 23:08:30 1995
--- http_config.h	Sat Aug 12 23:09:44 1995
***************
*** 82,88 ****
    void *cmd_data;		/* Extra data, for functions which
  				 * implement multiple commands...
  				 */
!   int req_override;		/* What overrides need to be allowed to
  				 * enable this command.
  				 */
    enum cmd_how args_how;	/* What the command expects as arguments */
--- 82,88 ----
    void *cmd_data;		/* Extra data, for functions which
  				 * implement multiple commands...
  				 */
!   long req_override;		/* What overrides need to be allowed to
  				 * enable this command.
  				 */
    enum cmd_how args_how;	/* What the command expects as arguments */
***************
*** 101,107 ****
  #define OR_UNSET 32
  #define ACCESS_CONF 64		/* command valid in access.conf */
  #define RSRC_CONF 128		/* command valid in srm.conf */
! #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
  
  /*
   * This structure is passed to a command which is being invoked,
--- 101,108 ----
  #define OR_UNSET 32
  #define ACCESS_CONF 64		/* command valid in access.conf */
  #define RSRC_CONF 128		/* command valid in srm.conf */
! #define OR_ERRORS 1024
! #define OR_ALL (OR_ERRORS|OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
  
  /*
   * This structure is passed to a command which is being invoked,
***************
*** 111,117 ****
  
  typedef struct {
      void *info;			/* Argument to command from cmd_table */
!     int override;		/* Which allow-override bits are set */
      int limited;		/* Which methods are <Limit>ed */
      
      char *config_file;		/* Filename cmd read from */
--- 112,118 ----
  
  typedef struct {
      void *info;			/* Argument to command from cmd_table */
!     long override;		/* Which allow-override bits are set */
      int limited;		/* Which methods are <Limit>ed */
      
      char *config_file;		/* Filename cmd read from */
*** http_core.c.dist	Sat Aug 12 23:03:55 1995
--- http_core.c	Sat Aug 12 23:06:56 1995
***************
*** 178,184 ****
      return conf->opts; 
  } 
  
! int allow_overrides (request_rec *r) 
  { 
      core_dir_config *conf = 
        (core_dir_config *)get_module_config(r->per_dir_config, &core_module); 
--- 178,184 ----
      return conf->opts; 
  } 
  
! long allow_overrides (request_rec *r) 
  { 
      core_dir_config *conf = 
        (core_dir_config *)get_module_config(r->per_dir_config, &core_module); 
***************
*** 320,325 ****
--- 320,327 ----
  	    d->override |= OR_AUTHCFG;
  	else if(!strcasecmp(w,"Indexes"))
              d->override |= OR_INDEXES;
+ 	else if(!strcasecmp(w,"Errors"))
+             d->override |= OR_ERRORS;
  	else if(!strcasecmp(w,"None"))
  	    d->override = OR_NONE;
  	else if(!strcasecmp(w,"All")) 
***************
*** 582,588 ****
    
  { "AccessFileName", set_access_name, NULL, RSRC_CONF, TAKE1, NULL },
  { "DocumentRoot", set_document_root, NULL, RSRC_CONF, TAKE1, NULL },
! { "ErrorDocument", set_error_document, NULL, RSRC_CONF, RAW_ARGS, NULL },
  { "AllowOverride", set_override, NULL, ACCESS_CONF, RAW_ARGS, NULL },
  { "Options", set_options, NULL, OR_OPTIONS, RAW_ARGS, NULL },
  { "DefaultType", set_string_slot,
--- 584,590 ----
    
  { "AccessFileName", set_access_name, NULL, RSRC_CONF, TAKE1, NULL },
  { "DocumentRoot", set_document_root, NULL, RSRC_CONF, TAKE1, NULL },
! { "ErrorDocument", set_error_document, NULL, OR_ERRORS, RAW_ARGS, NULL },
  { "AllowOverride", set_override, NULL, ACCESS_CONF, RAW_ARGS, NULL },
  { "Options", set_options, NULL, OR_OPTIONS, RAW_ARGS, NULL },
  { "DefaultType", set_string_slot,
*** http_core.h.dist	Sat Aug 12 23:04:56 1995
--- http_core.h	Sat Aug 12 23:05:48 1995
***************
*** 81,87 ****
  #define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI)
  
  int allow_options (request_rec *);
! int allow_overrides (request_rec *);
  char *default_type (request_rec *);     
  char *document_root (request_rec *); /* Don't use this!  If your request went
  				      * through a Userdir, or something like
--- 81,87 ----
  #define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI)
  
  int allow_options (request_rec *);
! long allow_overrides (request_rec *);
  char *default_type (request_rec *);     
  char *document_root (request_rec *); /* Don't use this!  If your request went
  				      * through a Userdir, or something like
***************
*** 120,126 ****
  /* Per-directory configuration */
  
  typedef char allow_options_t;
! typedef char overrides_t;
  
  typedef struct {
      char *d;
--- 120,126 ----
  /* Per-directory configuration */
  
  typedef char allow_options_t;
! typedef long overrides_t;
  
  typedef struct {
      char *d;

--- cut here ---