coar        98/05/07 05:24:31

  Modified:    .        STATUS
               htdocs/manual/mod core.html
               src      CHANGES buildmark.c
               src/include http_conf_globals.h httpd.h
               src/main http_core.c http_main.c
               src/os/bs2000 os.h
               src/os/emx os.h
               src/os/unix os.h
               src/os/win32 os.h
  Log:
        Add the core AddVersionComponent and AddVersionPlatform directives,
        which make the SERVER_SUBVERSION functionality a runtime thing and
        allow adding OS identity to the Server-Version string respectively.
  
  PR:           2056
  Reviewed by:  Jim Jagielski, Martin Kraemer, Brian Behlendorf
  
  Revision  Changes    Path
  1.381     +1 -7      apache-1.3/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/STATUS,v
  retrieving revision 1.380
  retrieving revision 1.381
  diff -u -r1.380 -r1.381
  --- STATUS    1998/05/07 02:48:22     1.380
  +++ STATUS    1998/05/07 12:24:20     1.381
  @@ -56,12 +56,6 @@
   
   Available Patches:
   
  -    * Ken's Adding the OS Type Patch
  -      <[EMAIL PROTECTED]>
  -      Status: Ken +1, Jim +1 (with Brian's suggested changes),
  -              Martin +1, Brian +1 (change 'add_component' and
  -           'add_platform' to something a bit more clear)
  -
       * Ed Korthof's patch to fix protocol issues surrounding 400, 408, and
         414 responses.
         <[EMAIL PROTECTED]>
  @@ -132,7 +126,7 @@
        (feb98 archives)
        Jim: I thought that we decided "default", although Ken
             thought it ugly
  -     Ken: I just don't like using "Add" when reverting something; no -1
  +     Ken: I just don't like using "Add" when reverting something; not a -1
   
       * proxy_*_canon routines use r->proxyreq incorrectly.  See
        <[EMAIL PROTECTED]>
  
  
  
  1.113     +101 -1    apache-1.3/htdocs/manual/mod/core.html
  
  Index: core.html
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/htdocs/manual/mod/core.html,v
  retrieving revision 1.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- core.html 1998/05/06 11:04:36     1.112
  +++ core.html 1998/05/07 12:24:21     1.113
  @@ -24,6 +24,8 @@
   <LI><A HREF="#accessconfig">AccessConfig</A>
   <LI><A HREF="#accessfilename">AccessFileName</A>
   <LI><A HREF="#addmodule">AddModule</A>
  +<LI><A HREF="#addversioncomponent">AddVersionComponent</A>
  +<LI><A HREF="#addversionplatform">AddVersionPlatform</A>
   <LI><A HREF="#allowoverride">AllowOverride</A>
   <LI><A HREF="#authname">AuthName</A>
   <LI><A HREF="#authtype">AuthType</A>
  @@ -178,6 +180,101 @@
   be cleared with the <A HREF="#clearmodulelist">ClearModuleList</A>
   directive.<P><HR>
   
  +<H2><A name="addversioncomponent">AddVersionComponent directive</A></H2>
  +<!--%plaintext &lt;?INDEX {\tt AddVersionComponent} directive&gt; -->
  +<A
  + HREF="directive-dict.html#Syntax"
  + REL="Help"
  +><STRONG>Syntax:</STRONG></A> AddVersionComponent <EM>string</EM><BR>
  +<A
  + HREF="directive-dict.html#Context"
  + REL="Help"
  +><STRONG>Context:</STRONG></A> server config <BR>
  +<A
  + HREF="directive-dict.html#Status"
  + REL="Help"
  +><STRONG>Status:</STRONG></A> core<BR>
  +<A
  + HREF="directive-dict.html#Compatibility"
  + REL="Help"
  +><STRONG>Compatibility:</STRONG></A> AddVersionComponent is only available
  + in Apache 1.3 and later
  +
  +<P>
  +Use this directive to add a string to the <SAMP>Server-Version</SAMP>
  +response header field which is sent back to clients.  This field identifies
  +the server software as the Apache Web server, and can also list additional
  +information.  This directive may occur multiple times, and the results are
  +cumulative.  In each case the string should take one of the following forms:
  +</P>
  +<DL>
  + <DD><CODE>AddVersionComponent "(some comment within parentheses)"</CODE>
  +  <DL>
  +   <DD><EM>or</EM>
  +   </DD>
  +  </DL>
  +  <CODE>AddVersionComponent "component-name/major.minor"</CODE>
  + </DD>
  +</DL>
  +<P>
  +that is, the string should either be arbitrary text enclosed in parentheses,
  +or else a specific component token and version number (such as "mymod/1.0").
  +</P>
  +<P>
  +This setting applies to the entire server, and cannot be enabled or
  +disabled on a virtualhost-by-virtualhost basis.
  +</P>
  +<P>
  +This directive replaces the <SAMP>SERVER_SUBVERSION</SAMP> setting
  +that was available in earlier versions of the Apache Web server.
  +</P><HR>
  +
  +<H2><A name="addversionplatform">AddVersionPlatform directive</A></H2>
  +<!--%plaintext &lt;?INDEX {\tt AddVersionPlatform} directive&gt; -->
  +<A
  + HREF="directive-dict.html#Syntax"
  + REL="Help"
  +><STRONG>Syntax:</STRONG></A> AddVersionPlatform <EM>On|Off</EM><BR>
  +<A
  + HREF="directive-dict.html#Context"
  + REL="Help"
  +><STRONG>Context:</STRONG></A> server config <BR>
  +<A
  + HREF="directive-dict.html#Status"
  + REL="Help"
  +><STRONG>Status:</STRONG></A> core<BR>
  +<A
  + HREF="directive-dict.html#Compatibility"
  + REL="Help"
  +><STRONG>Compatibility:</STRONG></A> AddVersionPlatform is only available
  + in Apache 1.3 and later
  +
  +<P>
  +This directive controls whether the server's operating system platform
  +will be identified in the <SAMP>Server-Version</SAMP> response header
  +field which is sent back to clients.  If enabled, a non-specific platform
  +designation will be added to the identity string, as shown below:
  +</P>
  +<DL>
  + <DT><CODE>AddVersionPlatform Off</CODE>
  + </DT>
  + <DD>Server sends: <SAMP>Server-Version: Apache/1.3.0</SAMP>
  + </DD>
  + <DT><CODE>AddVersionPlatform On</CODE>
  + </DT>
  + <DD>Server sends: <SAMP>Server-Version: Apache/1.3.0 (UNIX)</SAMP>
  + </DD>
  +</DL>
  +<P>
  +This setting applies to the entire server, and cannot be enabled or
  +disabled on a virtualhost-by-virtualhost basis.
  +</P>
  +<P>
  +By default, this information is <EM>not</EM> included in the server
  +identity string.
  +</P>
  +<HR>
  +
   <H2><A name="allowoverride">AllowOverride directive</A></H2>
   <!--%plaintext &lt;?INDEX {\tt AllowOverride} directive&gt; -->
   <A
  @@ -373,7 +470,10 @@
    HREF="directive-dict.html#Status"
    REL="Help"
   ><STRONG>Status:</STRONG></A> core<BR>
  -<STRONG>Compatibility:</STRONG></A> BS2000AuthFile is only available for 
BS2000 machines, as of Apache 1.3 and later.<P>
  +<A
  + HREF="directive-dict.html#Compatibility"
  + REL="Help"
  +><STRONG>Compatibility:</STRONG></A> BS2000AuthFile is only available for 
BS2000 machines, as of Apache 1.3 and later.<P>
   
   The <CODE>BS2000AuthFile</CODE> directive is available for BS2000 hosts
   only. It must be used to define the password file which is used to
  
  
  
  1.831     +9 -1      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.830
  retrieving revision 1.831
  diff -u -r1.830 -r1.831
  --- CHANGES   1998/05/07 07:52:48     1.830
  +++ CHANGES   1998/05/07 12:24:22     1.831
  @@ -1,5 +1,13 @@
   Changes with Apache 1.3b7
  -  
  +
  +  *) Added the AddVersionComponent and AddVersionPlatform core directives.
  +     The first allows the addition of arbitrary text to the Server-Version
  +     response header field value, replacing the SERVER_SUBVERSION define in
  +     the Configuration file with run-time settings (more useful in
  +     a loadable-module environment).  AddVersionPlatform inserts a comment
  +     such as "(UNIX)" or "(Win32)" into the server version string.
  +     [Ken Coar] PR#2056
  +
     *) Minor stability tweaks to avoid core dumps in ap_snprintf.
        [Martin Kraemer]
   
  
  
  
  1.7       +0 -6      apache-1.3/src/buildmark.c
  
  Index: buildmark.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/buildmark.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- buildmark.c       1998/04/11 12:00:16     1.6
  +++ buildmark.c       1998/05/07 12:24:23     1.7
  @@ -63,14 +63,8 @@
   #else
   static const char server_built[] = "unknown";
   #endif
  -static const char server_version[] = SERVER_VERSION;
   
   API_EXPORT(const char *) ap_get_server_built()
   {
       return server_built;
  -}
  -
  -API_EXPORT(const char *) ap_get_server_version()
  -{
  -    return server_version;
   }
  
  
  
  1.30      +2 -0      apache-1.3/src/include/http_conf_globals.h
  
  Index: http_conf_globals.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/http_conf_globals.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- http_conf_globals.h       1998/05/03 17:31:08     1.29
  +++ http_conf_globals.h       1998/05/07 12:24:24     1.30
  @@ -91,6 +91,8 @@
   extern char *ap_lock_fname;
   extern MODULE_VAR_EXPORT char *ap_server_argv0;
   
  +extern int ap_note_platform;
  +
   /* Trying to allocate these in the config pool gets us into some *nasty*
    * chicken-and-egg problems in http_main.c --- where do you stick them
    * when pconf gets cleared?  Better to just allocate a little space
  
  
  
  1.210     +1 -0      apache-1.3/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
  retrieving revision 1.209
  retrieving revision 1.210
  diff -u -r1.209 -r1.210
  --- httpd.h   1998/05/04 17:19:54     1.209
  +++ httpd.h   1998/05/07 12:24:24     1.210
  @@ -395,6 +395,7 @@
   #endif
   
   API_EXPORT(const char *) ap_get_server_version(void);
  +API_EXPORT(void) ap_add_version_component(const char *component);
   API_EXPORT(const char *) ap_get_server_built(void);
   
   /* Numeric release version identifier: major minor bugfix betaseq
  
  
  
  1.194     +34 -1     apache-1.3/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
  retrieving revision 1.193
  retrieving revision 1.194
  diff -u -r1.193 -r1.194
  --- http_core.c       1998/05/07 01:21:22     1.193
  +++ http_core.c       1998/05/07 12:24:25     1.194
  @@ -1871,6 +1871,33 @@
   }
   #endif /*_OSD_POSIX*/
   
  +/*
  + * Handle a request to add an arbitrary string to the Server-Version response
  + * header field (the AddVersionComponent directive).
  + */
  +
  +static const char *add_version_component(cmd_parms *cmd, void *mconfig, 
  +                                      char *word1)
  +{
  +    ap_add_version_component((const char *)word1);
  +    return NULL;
  +}
  +
  +/*
  + * Handle a request to include the server's OS platform in the Server-Version
  + * response header field (the AddVersionPlatform directive).  Unfortunately
  + * this requires a new global in order to communicate the setting back to
  + * http_main so it can insert the information in the right place in the
  + * string.
  + */
  +
  +static const char *enable_platform_announcement(cmd_parms *cmd, void 
*mconfig,
  +                                             int bool)
  +{
  +    ap_note_platform = bool;
  +    return NULL;
  +}
  +
   /* Note --- ErrorDocument will now work from .htaccess files.  
    * The AllowOverride of Fileinfo allows webmasters to turn it off
    */
  @@ -1879,7 +1906,9 @@
   
   /* Old access config file commands */
   
  -{ "<Directory", dirsection, NULL, RSRC_CONF, RAW_ARGS, "Container for 
directives affecting resources located in the specified directories" },
  +{ "<Directory", dirsection, NULL, RSRC_CONF, RAW_ARGS,
  +  "Container for directives affecting resources located in the specified "
  +  "directories" },
   { end_directory_section, end_nested_section, NULL, ACCESS_CONF, NO_ARGS, 
"Marks end of <Directory>" },
   { "<Location", urlsection, NULL, RSRC_CONF, RAW_ARGS, "Container for 
directives affecting resources accessed through the specified URL paths" },
   { end_location_section, end_nested_section, NULL, ACCESS_CONF, NO_ARGS, 
"Marks end of <Location>" },
  @@ -2006,6 +2035,10 @@
   { "BS2000AuthFile", set_bs2000_authfile, NULL, RSRC_CONF, TAKE1,
     "server User's bs2000 logon password file (read-protected)" },
   #endif
  +{ "AddVersionComponent", add_version_component, NULL, RSRC_CONF, TAKE1,
  +  "String to be added to the Server-Version text" },
  +{ "AddVersionPlatform", enable_platform_announcement, NULL, RSRC_CONF, FLAG,
  +  "Set to 'on' to include server OS platform in Server-Version text" },
   { NULL },
   };
   
  
  
  
  1.332     +68 -1     apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.331
  retrieving revision 1.332
  diff -u -r1.331 -r1.332
  --- http_main.c       1998/05/06 21:00:38     1.331
  +++ http_main.c       1998/05/07 12:24:25     1.332
  @@ -329,13 +329,76 @@
   static pool *pchild;         /* Pool for httpd child stuff */
   static pool *pcommands;      /* Pool for -C and -c switches */
   
  -static int APACHE_TLS my_pid;                /* it seems silly to call 
getpid all the time */
  +static int APACHE_TLS my_pid;        /* it seems silly to call getpid all 
the time */
   #ifndef MULTITHREAD
   static int my_child_num;
   #endif
   
   scoreboard *ap_scoreboard_image = NULL;
   
  +/*
  + * Pieces for managing the contents of the Server-Version response header
  + * field.
  + */
  +static char *server_version = NULL;
  +static int version_locked = 0;
  +
  +int ap_note_platform = 0;  /* Global, alas, so http_core can talk to us */
  +
  +/*
  + * This routine is called when the pconf pool is vacuumed.  It resets the
  + * server version string to a known value and [re]enables modifications
  + * (which are disabled by configuration completion).
  + */
  +static void reset_version()
  +{
  +    version_locked = 0;
  +    ap_note_platform = 0;
  +    server_version = NULL;
  +}
  +
  +API_EXPORT(const char *) ap_get_server_version()
  +{
  +    return server_version;
  +}
  +
  +API_EXPORT(void) ap_add_version_component(const char *component)
  +{
  +    if (! version_locked) {
  +        /*
  +         * If the version string is null, register our cleanup to reset the
  +         * pointer on pool destruction.
  +         */
  +        if (server_version == NULL) {
  +         ap_register_cleanup(pconf, NULL, (void (*)(void *))reset_version, 
  +                             NULL);
  +         server_version = ap_pstrdup(pconf, component);
  +     }
  +     else {
  +         /*
  +          * Prepend the given component identifier to the existing string
  +          */
  +         server_version = ap_pstrcat(pconf, component, " ", server_version,
  +                                 NULL);
  +     }
  +    }
  +}
  +
  +/*
  + * This routine adds the real server base identity to the version string,
  + * and then locks out changes until the next reconfig.
  + */
  +static void ap_set_version()
  +{
  +    if (ap_note_platform) {
  +        ap_add_version_component(SERVER_BASEVERSION " (" PLATFORM ")");
  +    }
  +    else {
  +        ap_add_version_component(SERVER_BASEVERSION);
  +    }
  +    version_locked++;
  +}
  +
   static APACHE_TLS int volatile exit_after_unblock = 0;
   
   /* a clean exit from a child with proper cleanup */
  @@ -3772,6 +3835,7 @@
        ap_open_logs(server_conf, pconf);
        ap_log_pid(pconf, ap_pid_fname);
        ap_init_modules(pconf, server_conf);
  +     ap_set_version();
        SAFE_ACCEPT(accept_mutex_init(pconf));
        if (!is_graceful) {
            reinit_scoreboard(pconf);
  @@ -4057,6 +4121,7 @@
       if (ap_standalone) {
        ap_open_logs(server_conf, pconf);
        ap_init_modules(pconf, server_conf);
  +     ap_set_version();
        STANDALONE_MAIN(argc, argv);
       }
       else {
  @@ -4928,6 +4993,7 @@
        server_conf = ap_read_config(pconf, pparent, ap_server_confname);
        ap_open_logs(server_conf, pconf);
        ap_init_modules(pconf, server_conf);
  +     ap_set_version();
        if (!is_graceful)
            reinit_scoreboard(pconf);
   
  @@ -5163,6 +5229,7 @@
       ap_log_pid(pconf, ap_pid_fname);
       ap_init_modules(pconf, server_conf);
       ap_suexec_enabled = init_suexec();
  +    ap_set_version();
       ap_open_logs(server_conf, pconf);
       set_group_privs();
   
  
  
  
  1.8       +7 -3      apache-1.3/src/os/bs2000/os.h
  
  Index: os.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/os/bs2000/os.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- os.h      1998/04/13 18:05:17     1.7
  +++ os.h      1998/05/07 12:24:27     1.8
  @@ -1,5 +1,8 @@
  -#ifndef AP_OS_BS2000_OS_H
  -#define AP_OS_BS2000_OS_H
  +#ifndef APACHE_OS_H
  +#define APACHE_OS_H
  +
  +#define PLATFORM "BS2000"
  +
   /*
    * This file in included in all Apache source code. It contains definitions
    * of facilities available on _this_ operating system (HAVE_* macros),
  @@ -27,4 +30,5 @@
    * to use request_rec here... */
   struct request_rec;
   extern int ap_checkconv(struct request_rec *r);
  -#endif /*AP_OS_BS2000_OS_H*/
  +
  +#endif /*! APACHE_OS_H*/
  
  
  
  1.5       +7 -0      apache-1.3/src/os/emx/os.h
  
  Index: os.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/os/emx/os.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- os.h      1998/04/13 18:05:18     1.4
  +++ os.h      1998/05/07 12:24:28     1.5
  @@ -1,3 +1,8 @@
  +#ifndef APACHE_OS_H
  +#define APACHE_OS_H
  +
  +#define PLATFORM "OS/2"
  +
   /*
    * This file in included in all Apache source code. It contains definitions
    * of facilities available on _this_ operating system (HAVE_* macros),
  @@ -21,3 +26,5 @@
   
   /* OS/2 doesn't have symlinks so S_ISLNK is always false */
   #define S_ISLNK(m) 0
  +
  +#endif   /* ! APACHE_OS_H */
  
  
  
  1.23      +2 -0      apache-1.3/src/os/unix/os.h
  
  Index: os.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/os/unix/os.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- os.h      1998/04/30 11:27:04     1.22
  +++ os.h      1998/05/07 12:24:30     1.23
  @@ -58,6 +58,8 @@
   #ifndef APACHE_OS_H
   #define APACHE_OS_H
   
  +#define PLATFORM "UNIX"
  +
   /*
    * This file in included in all Apache source code. It contains definitions
    * of facilities available on _this_ operating system (HAVE_* macros),
  
  
  
  1.18      +7 -0      apache-1.3/src/os/win32/os.h
  
  Index: os.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/os/win32/os.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- os.h      1998/04/13 18:05:20     1.17
  +++ os.h      1998/05/07 12:24:31     1.18
  @@ -1,3 +1,8 @@
  +#ifndef APACHE_OS_H
  +#define APACHE_OS_H
  +
  +#define PLATFORM "Win32"
  +
   /*
    * This file in included in all Apache source code. It contains definitions
    * of facilities available on _this_ operating system (HAVE_* macros),
  @@ -106,3 +111,5 @@
   #define ap_os_dso_unload(l) FreeLibrary(l)
   #define ap_os_dso_sym(h,s)  GetProcAddress(h,s)
   #define ap_os_dso_error()   ""       /* for now */
  +
  +#endif   /* ! APACHE_OS_H */
  
  
  

Reply via email to