You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/06/05 21:44:03 UTC

cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread mpmt_pthread.c

rbb         00/06/05 12:44:03

  Modified:    .        STATUS
               src      CHANGES
               src/include httpd.h
               src/main http_core.c
               src/modules/mpm/dexter dexter.c
               src/modules/mpm/mpmt_beos mpmt_beos.c
               src/modules/mpm/mpmt_pthread mpmt_pthread.c
  Log:
  Add server tokens back to 2.0.  Also bring forward the change to allow
  the PRODUCT_ONLY value for ServerTokens.  This is relatively clean,
  all of the code lives in http_core, and when a module wants to add a token,
  they just call ap_add_version_component from the post_config hook.  Actually
  ap_add_version_component can be done anytime after the config has been
  parsed, it just makes the most sense to do it in post_config IMHO.
  
  Revision  Changes    Path
  1.77      +1 -3      apache-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/apache-2.0/STATUS,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- STATUS	2000/06/02 19:45:40	1.76
  +++ STATUS	2000/06/05 19:43:57	1.77
  @@ -1,5 +1,5 @@
   Apache 2.0 STATUS:
  -Last modified at [$Date: 2000/06/02 19:45:40 $]
  +Last modified at [$Date: 2000/06/05 19:43:57 $]
   
   Release:
   
  @@ -9,8 +9,6 @@
       2.0a1   : released March 10, 2000
   
   RELEASE SHOWSTOPPERS:
  -    * Reimplement the server tokens
  -
       * Win32: Get mod_auth_digest working under win32
         - APR_HAS_RANDOM should be defined on windows and there is a 
         lib/apr/misc/win32/rand.c which is basically a copy of what
  
  
  
  1.134     +4 -2      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.133
  retrieving revision 1.134
  diff -u -r1.133 -r1.134
  --- CHANGES	2000/06/05 17:30:32	1.133
  +++ CHANGES	2000/06/05 19:43:57	1.134
  @@ -1,6 +1,8 @@
   Changes with Apache 2.0a5
  -
  -
  +  *) Server Tokens work in 2.0 again.  This also propogates the change
  +     to allow just the product name in the server string using
  +     PRODUCT_ONLY.
  +     [Ryan Bloom]
   
   Changes with Apache 2.0a4
     *) EBCDIC: Rearrange calls to ap_checkconv() so that most handlers
  
  
  
  1.54      +3 -12     apache-2.0/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/httpd.h,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- httpd.h	2000/06/05 17:30:27	1.53
  +++ httpd.h	2000/06/05 19:43:58	1.54
  @@ -365,24 +365,15 @@
   #define APEXIT_CHILDINIT	0x3
   #define APEXIT_CHILDFATAL	0xf
   
  -/* TODO: re-implement the server token/version stuff -- it's part of http_core
  - * it should be possible to do without touching http_main at all. (or else
  - * we haven't got enough module hooks)
  - */
  -
   enum server_token_type {
       SrvTk_MIN,		/* eg: Apache/1.3.0 */
       SrvTk_OS,		/* eg: Apache/1.3.0 (UNIX) */
  -    SrvTk_FULL		/* eg: Apache/1.3.0 (UNIX) PHP/3.0 FooBar/1.2b */
  +    SrvTk_FULL,		/* eg: Apache/1.3.0 (UNIX) PHP/3.0 FooBar/1.2b */
  +    SrvTk_PRODUCT_ONLY	/* eg: Apache */
   };
   
  -#if 0
   API_EXPORT(const char *) ap_get_server_version(void);
  -API_EXPORT(void) ap_add_version_component(const char *component);
  -#else
  -#define ap_get_server_version()	(AP_SERVER_BASEVERSION)
  -#define ap_add_version_component(x) ((void)0)
  -#endif
  +API_EXPORT(void) ap_add_version_component(ap_pool_t pconf, const char *component);
   API_EXPORT(const char *) ap_get_server_built(void);
   
   /* Numeric release version identifier: MMNNFFRBB: major minor fix final beta
  
  
  
  1.66      +73 -3     apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- http_core.c	2000/06/03 22:41:01	1.65
  +++ http_core.c	2000/06/05 19:43:59	1.66
  @@ -2040,6 +2040,70 @@
    * string.
    */
   
  +static char *server_version = NULL;
  +static int version_locked = 0; 
  +static enum server_token_type ap_server_tokens = SrvTk_FULL;
  +
  +static ap_status_t reset_version(void *dummy)
  +{
  +    version_locked = 0;
  +    ap_server_tokens = SrvTk_FULL;
  +    server_version = NULL;
  +}
  +
  +API_EXPORT(const char *) ap_get_server_version(void)
  +{
  +    return (server_version ? server_version : AP_SERVER_BASEVERSION);
  +}
  +
  +API_EXPORT(void) ap_add_version_component(ap_pool_t *pconf, const char *component)
  +{
  +    if (! version_locked) {
  +        /*
  +         * If the version string is null, register our cleanup to reset the
  +         * pointer on pool destruction. We also know that, if NULL,
  +         * we are adding the original SERVER_BASEVERSION string.
  +         */
  +        if (server_version == NULL) {
  +            ap_register_cleanup(pconf, NULL, reset_version,
  +                                ap_null_cleanup);
  +            server_version = ap_pstrdup(pconf, component);
  +        }
  +        else {
  +            /*
  +             * Tack the given component identifier to the end of
  +             * the existing string.
  +             */
  +            server_version = ap_pstrcat(pconf, server_version, " ",
  +                                        component, 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(ap_pool_t *pconf)
  +{
  +    if (ap_server_tokens == SrvTk_PRODUCT_ONLY) {
  +        ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT);
  +    }
  +    else if (ap_server_tokens == SrvTk_MIN) {
  +        ap_add_version_component(pconf, AP_SERVER_BASEVERSION);
  +    }
  +    else {
  +        ap_add_version_component(pconf, AP_SERVER_BASEVERSION " (" PLATFORM ")");
  +    }
  +    /*
  +     * Lock the server_version string if we're not displaying
  +     * the full set of tokens
  +     */
  +    if (ap_server_tokens != SrvTk_FULL) {
  +        version_locked++;
  +    }
  +}
  +
   static const char *set_serv_tokens(cmd_parms *cmd, void *dummy, char *arg) 
   {
       const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  @@ -2047,18 +2111,18 @@
           return err;
       }
   
  -    /* TODO: reimplement the server token stuff. */
  -#if 0
       if (!strcasecmp(arg, "OS")) {
           ap_server_tokens = SrvTk_OS;
       }
       else if (!strcasecmp(arg, "Min") || !strcasecmp(arg, "Minimal")) {
           ap_server_tokens = SrvTk_MIN;
       }
  +    else if (!strcasecmp(arg, "Prod") || !strcasecmp(arg, "ProductOnly")) {
  +        ap_server_tokens = SrvTk_PRODUCT_ONLY;
  +    }
       else {
           ap_server_tokens = SrvTk_FULL;
       }
  -#endif
       return NULL;
   }
   
  @@ -2532,6 +2596,11 @@
   { NULL, NULL }
   };
   
  +static void core_post_config(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp, server_rec *s)
  +{
  +    ap_set_version(pconf);
  +}
  +
   static void core_open_logs(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp, server_rec *s)
   {
       ap_open_logs(s, pconf);
  @@ -2545,6 +2614,7 @@
   
   static void register_hooks(void)
   {
  +    ap_hook_post_config(core_post_config,NULL,NULL,AP_HOOK_REALLY_FIRST);
       ap_hook_translate_name(core_translate,NULL,NULL,AP_HOOK_REALLY_LAST);
       ap_hook_process_connection(ap_process_http_connection,NULL,NULL,
   			       AP_HOOK_REALLY_LAST);
  
  
  
  1.90      +0 -3      apache-2.0/src/modules/mpm/dexter/dexter.c
  
  Index: dexter.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- dexter.c	2000/06/02 15:33:15	1.89
  +++ dexter.c	2000/06/05 19:44:01	1.90
  @@ -164,9 +164,6 @@
   static char *lock_fname;
   static pthread_mutex_t thread_accept_mutex = PTHREAD_MUTEX_INITIALIZER;
   
  -/* Global, alas, so http_core can talk to us */
  -enum server_token_type ap_server_tokens = SrvTk_FULL;
  -
   API_EXPORT(const server_rec *) ap_get_server_conf(void)
   {
       return (ap_server_conf);
  
  
  
  1.30      +0 -3      apache-2.0/src/modules/mpm/mpmt_beos/mpmt_beos.c
  
  Index: mpmt_beos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_beos/mpmt_beos.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- mpmt_beos.c	2000/06/03 16:58:08	1.29
  +++ mpmt_beos.c	2000/06/05 19:44:02	1.30
  @@ -139,9 +139,6 @@
   int raise_sigstop_flags;
   #endif
   
  -/* Global, alas, so http_core can talk to us */
  -enum server_token_type ap_server_tokens = SrvTk_FULL;
  -
   API_EXPORT(const server_rec *) ap_get_server_conf(void)
   {
       return (ap_server_conf);
  
  
  
  1.82      +0 -4      apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c
  
  Index: mpmt_pthread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- mpmt_pthread.c	2000/06/02 15:33:18	1.81
  +++ mpmt_pthread.c	2000/06/05 19:44:02	1.82
  @@ -161,10 +161,6 @@
   #define SAFE_ACCEPT(stmt) (stmt)
   #endif
   
  -
  -/* Global, alas, so http_core can talk to us */
  -enum server_token_type ap_server_tokens = SrvTk_FULL;
  -
   API_EXPORT(const server_rec *) ap_get_server_conf(void)
   {
       return (ap_server_conf);