httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodent of Unusual Size <Ken.C...@Golux.Com>
Subject Re: Adding the OS type
Date Tue, 05 May 1998 11:44:42 GMT
All right, here's a partial patch to address this.  It's not
complete because:

 o there's no provision for either SERVER_SUBVERSION or a
   AddServerComponentID (or whatever directive)
 o there's no provision for the "(platform)" stuff

Before I add those pieces, I want to make sure people like what I've
got so far.  Preliminary tests indicate that it does the job, but
I'd appreciate feedback.  I had to add a LockFile (heretofore
missing from my config) for some reason after adding a test call to
mod_mime, but I think that's unrelated.

Comments?

#ken	P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Group member         <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>

Index: buildmark.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/buildmark.c,v
retrieving revision 1.6
diff -u -r1.6 buildmark.c
--- buildmark.c 1998/04/11 12:00:16     1.6
+++ buildmark.c 1998/05/05 11:31:53
@@ -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;
 }
Index: include/httpd.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.209
diff -u -r1.209 httpd.h
--- httpd.h     1998/05/04 17:19:54     1.209
+++ httpd.h     1998/05/05 11:31:59
@@ -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
Index: main/http_main.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.330
diff -u -r1.330 http_main.c
--- http_main.c 1998/05/04 16:46:40     1.330
+++ http_main.c 1998/05/05 11:32:07
@@ -329,13 +329,63 @@
 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;
+
+/*
+ * 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;
+    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);
+       }
+       /* Prepend the given component identifier to the 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()
+{
+    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 +3822,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 +4108,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 +4980,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 +5216,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();

Mime
View raw message