httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@kiwi.ICS.UCI.EDU>
Subject Changes for httpd -h
Date Fri, 04 Oct 1996 06:33:57 GMT
Please have a look at these changes for the "httpd -h" output.
You might want to run that first, before applying the patch,
just to see what the current output looks like.
Note that I moved the print routines to http_config, since that is
where they belong (even without the changes).

I couldn't think of any reason for preferring the single-line output
over multiple lines, since both are machine-readable and only the
latter is human readable.  If there is already a program out there
that processes the old format, then we could change the option to -H,
though there is no documentation on the current -h option either.

.....Roy

Index: http_config.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.h,v
retrieving revision 1.11
diff -c -r1.11 http_config.h
*** http_config.h	1996/08/20 11:50:43	1.11
--- http_config.h	1996/10/04 06:17:14
***************
*** 1,5 ****
  /* ====================================================================
!  * Copyright (c) 1995 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
--- 1,5 ----
  /* ====================================================================
!  * Copyright (c) 1995, 1996 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
***************
*** 86,93 ****
    char *errmsg;			/* 'usage' message, in case of syntax errors */
  } command_rec;
  
! /* Values for the req_override slot */
! 
  #define OR_NONE 0
  #define OR_LIMIT 1
  #define OR_OPTIONS 2
--- 86,107 ----
    char *errmsg;			/* 'usage' message, in case of syntax errors */
  } command_rec;
  
! /* The allowed locations for a configuration directive are the union of
!  * those indicated by each set bit in the req_override mask.
!  *
!  * (req_override & RSRC_CONF)   => *.conf outside <Directory> or <Location>
!  * (req_override & ACCESS_CONF) => *.conf inside <Directory> or <Location>
!  * (req_override & OR_AUTHCFG)  => *.conf inside <Directory> or <Location>
!  *                                 and .htaccess when AllowOverride AuthConfig
!  * (req_override & OR_LIMIT)    => *.conf inside <Directory> or <Location>
!  *                                 and .htaccess when AllowOverride Limit
!  * (req_override & OR_OPTIONS)  => *.conf anywhere
!  *                                 and .htaccess when AllowOverride Options
!  * (req_override & OR_FILEINFO) => *.conf anywhere
!  *                                 and .htaccess when AllowOverride FileInfo
!  * (req_override & OR_INDEXES)  => *.conf anywhere
!  *                                 and .htaccess when AllowOverride Indexes
!  */
  #define OR_NONE 0
  #define OR_LIMIT 1
  #define OR_OPTIONS 2
***************
*** 95,102 ****
  #define OR_AUTHCFG 8
  #define OR_INDEXES 16
  #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)
  
  /*
--- 109,116 ----
  #define OR_AUTHCFG 8
  #define OR_INDEXES 16
  #define OR_UNSET 32
! #define ACCESS_CONF 64
! #define RSRC_CONF 128
  #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
  
  /*
***************
*** 232,237 ****
--- 246,252 ----
  
  server_rec *read_config (pool *conf_pool, pool *temp_pool, char *config_name);
  void setup_prelinked_modules();
+ void show_directives();
  
  /* For http_request.c... */
  
Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.23
diff -c -r1.23 http_config.c
*** http_config.c	1996/09/23 03:01:03	1.23
--- http_config.c	1996/10/04 06:17:20
***************
*** 1,5 ****
  /* ====================================================================
!  * Copyright (c) 1995 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
--- 1,5 ----
  /* ====================================================================
!  * Copyright (c) 1995, 1996 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
***************
*** 82,89 ****
  /****************************************************************
   *
   * We begin with the functions which deal with the linked list
!  * of modules which control just about all of server operation in
!  * Shambhala.
   */
  
  static int num_modules = 0;    
--- 82,88 ----
  /****************************************************************
   *
   * We begin with the functions which deal with the linked list
!  * of modules which control just about all of the server operation.
   */
  
  static int num_modules = 0;    
***************
*** 915,919 ****
--- 914,1011 ----
  	    (*m->init) (s, p);
      
      return s;
+ }
+ 
+ /********************************************************************
+  * Configuration directives are restricted in terms of where they may
+  * appear in the main configuration files and/or .htaccess files according
+  * to the bitmask req_override in the command_rec structure.
+  * If any of the overrides set in req_override are also allowed in the
+  * context in which the command is read, then the command is allowed.
+  * The context is determined as follows:
+  *
+  *    inside *.conf --> override = (RSRC_CONF|OR_ALL)&~(OR_AUTHCFG|OR_LIMIT);
+  *    within <Directory> or <Location> --> override = OR_ALL|ACCESS_CONF;
+  *    within .htaccess --> override = AllowOverride for current directory;
+  *
+  * the result is, well, a rather confusing set of possibilities for when
+  * a particular directive is allowed to be used.  This procedure prints
+  * in English where the given (pc) directive can be used.
+  */
+ void show_overrides(command_rec *pc, module *pm)
+ {
+     int n = 0;
+     
+     printf("\tAllowed in *.conf ");
+     if ((pc->req_override & (OR_OPTIONS|OR_FILEINFO|OR_INDEXES)) ||
+         ((pc->req_override & RSRC_CONF) &&
+          ((pc->req_override & (ACCESS_CONF|OR_AUTHCFG|OR_LIMIT)))))
+         printf("anywhere");
+     else if (pc->req_override & RSRC_CONF)
+         printf("only outside <Directory> or <Location>");
+     else 
+         printf("only inside <Directory> or <Location>");
+ 
+     /* Warn if the directive is allowed inside <Directory> or .htaccess
+      * but module doesn't support per-dir configuration */
+ 
+     if ((pc->req_override & (OR_ALL|ACCESS_CONF)) && !pm->create_dir_config)
+         printf(" [no per-dir config]");
+ 
+     if (pc->req_override & OR_ALL) {
+         printf(" and in .htaccess\n\twhen AllowOverride");
+ 
+         if ((pc->req_override & OR_ALL) == OR_ALL)
+             printf(" isn't None");
+         else {
+             printf(" includes ");
+ 
+             if (pc->req_override & OR_AUTHCFG) {
+                 if (n++) printf(" or ");
+                 printf("AuthConfig");
+             }
+             if (pc->req_override & OR_LIMIT) {
+                 if (n++) printf(" or ");
+                 printf("Limit");
+             }
+             if (pc->req_override & OR_OPTIONS) {
+                 if (n++) printf(" or ");
+                 printf("Options");
+             }
+             if (pc->req_override & OR_FILEINFO) {
+                 if (n++) printf(" or ");
+                 printf("FileInfo");
+             }
+             if (pc->req_override & OR_INDEXES) {
+                 if (n++) printf(" or ");
+                 printf("Indexes");
+             }
+         }
+     }
+     printf("\n");
+ }
+ 
+ /* Show the prelinked configuration directives, the help string explaining
+  * the directive arguments, in what module they are handled, and in
+  * what parts of the configuration they are allowed.  Used for httpd -h.
+  */
+ void show_directives()
+ {
+     extern module *prelinked_modules[];
+     extern char *module_names[];
+     command_rec *pc;
+     int n;
+     int t;
+     
+     for(t=0 ; prelinked_modules[t] ; ++t)
+         ;
+     for(n=0 ; prelinked_modules[n] ; ++n)
+         for(pc=prelinked_modules[n]->cmds ; pc && pc->name ; ++pc) {
+             printf("%s\n", pc->name);
+             if (pc->errmsg)
+                 printf("\t%s\n", pc->errmsg);
+             printf("\t%s\n", module_names[t-n-1]);
+             show_overrides(pc, prelinked_modules[n]);
+         }
  }
  
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.75
diff -c -r1.75 http_main.c
*** http_main.c	1996/10/02 00:31:52	1.75
--- http_main.c	1996/10/04 06:17:28
***************
*** 1,5 ****
  /* ====================================================================
!  * Copyright (c) 1995 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
--- 1,5 ----
  /* ====================================================================
!  * Copyright (c) 1995, 1996 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
***************
*** 1847,1899 ****
      }
  
  } /* standalone_main */
- 
- void show_overrides(command_rec *pc,module *pm)
-     {
-     int n;
-     struct
- 	{
- 	int override;
- 	char letter;
- 	} aOvers[]= {
- 	{ OR_LIMIT, 'L' },
- 	{ OR_OPTIONS, 'O' },
- 	{ OR_FILEINFO, 'F' },
- 	{ OR_AUTHCFG, 'A' },
- 	{ OR_INDEXES, 'I' },
- 	{ ACCESS_CONF, 'a' },
- 	{ RSRC_CONF, 'r' },
- 	{ (OR_ALL|RSRC_CONF)&~(OR_LIMIT|OR_AUTHCFG), 'd' }, /* outside <Directory> */
- 	{ OR_ALL|ACCESS_CONF, 'D' }, /* inside <Directory> */
- 	{ 0, '\0' }
- 	};
- 	
-     for(n=0 ; aOvers[n].override ; ++n)
- 	if(pc->req_override&aOvers[n].override)
- 	    putchar(aOvers[n].letter);
-     if((pc->req_override&(OR_ALL|ACCESS_CONF)) && !pm->create_dir_config)
- 	putchar('!');	/* Directive allowed inside <Directory> but module doesn't support
per-dir config */
-     }
- 
- void show_directives()
-     {
-     extern module *prelinked_modules[];
-     extern char *module_names[];
-     command_rec *pc;
-     int n;
-     int t;
-     
-     for(t=0 ; prelinked_modules[t] ; ++t)
- 	;
-     for(n=0 ; prelinked_modules[n] ; ++n)
- 	for(pc=prelinked_modules[n]->cmds ; pc && pc->name ; ++pc)
- 	    {
- 	    printf("%s\t%s\t%s\t", pc->name, pc->errmsg ? pc->errmsg : "",
- 	           module_names[t-n-1]);
- 	    show_overrides(pc,prelinked_modules[n]);
- 	    putchar('\n');
- 	    }
-     }
  
  extern char *optarg;
  extern int optind;
--- 1847,1852 ----

Mime
View raw message