httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: SERVER_VERSION with OS
Date Tue, 21 Apr 1998 21:46:33 GMT
On Tue, 21 Apr 1998, Rodent of Unusual Size wrote:

> This gets a bit complicated because the basic server version
> string *should* be

This is not at all complicated.

Here's a patch.  Remove the calls from mod_rewrite and mod_mime before
committing, I used them to test the code. 

Dean

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/04/21 21:42:10
@@ -57,13 +57,13 @@
 
 #include "conf.h"
 #include "httpd.h"
+#include "http_conf_globals.h"
 
 #if defined(__DATE__) && defined(__TIME__)
 static const char server_built[] = __DATE__ " " __TIME__;
 #else
 static const char server_built[] = "unknown";
 #endif
-static const char server_version[] = SERVER_VERSION;
 
 API_EXPORT(const char *) ap_get_server_built()
 {
@@ -72,5 +72,5 @@
 
 API_EXPORT(const char *) ap_get_server_version()
 {
-    return server_version;
+    return ap_server_version;
 }
Index: include/http_conf_globals.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/http_conf_globals.h,v
retrieving revision 1.28
diff -u -r1.28 http_conf_globals.h
--- http_conf_globals.h	1998/04/19 20:10:44	1.28
+++ http_conf_globals.h	1998/04/21 21:42:11
@@ -82,6 +82,9 @@
 extern int ap_listenbacklog;
 extern int ap_dump_settings;
 
+extern char *ap_server_version;
+extern int ap_add_insecurity_to_server_version;
+
 extern char *ap_pid_fname;
 extern char *ap_scoreboard_fname;
 extern char *ap_lock_fname;
Index: include/http_config.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/http_config.h,v
retrieving revision 1.80
diff -u -r1.80 http_config.h
--- http_config.h	1998/04/13 18:11:51	1.80
+++ http_config.h	1998/04/21 21:42:11
@@ -307,6 +307,11 @@
 /* for implementing subconfigs and customized config files */
 API_EXPORT(const char *) ap_srm_command_loop(cmd_parms *parms, void *config);
 
+/* Add a tag to the server version string.  Should be in the form
+ * MyWidget/1.0.3.  See RFC2068 for more information.
+ */
+API_EXPORT(void) ap_add_server_version(pool *p, const char *s);
+
 #ifdef CORE_PRIVATE
 
 extern API_VAR_EXPORT module *top_module;
Index: include/httpd.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.206
diff -u -r1.206 httpd.h
--- httpd.h	1998/04/19 20:10:45	1.206
+++ httpd.h	1998/04/21 21:42:11
@@ -348,26 +348,16 @@
  * identifier below, please keep to the HTTP specification.  This states that
  * the identification string should consist of product tokens with an optional
  * slash and version designator.  Sub-products which form a significant part 
- * of the application can be listed, separated by whitespace, by adding
- * their product tokens to EXTRA_CFLAGS in the Configuration file like so.
+ * of the application can add to this string during their module init() phase
+ * by calling ap_add_server_subversion().
  *
- * EXTRA_CFLAGS="-DSERVER_SUBVERSION="MrWidget/0.1-alpha"
- *
- * The tokens are listed in order of their significance for identifying the
- * application.
- *
  * "Product tokens should be short and to the point -- use of them for 
  * advertizing or other non-essential information is explicitly forbidden."
  *
  * Example: "Apache/1.1.0 MrWidget/0.1-alpha" 
  */
 
-#define SERVER_BASEVERSION "Apache/1.3b7-dev"	/* SEE COMMENTS ABOVE */
-#ifdef SERVER_SUBVERSION
-#define SERVER_VERSION	SERVER_BASEVERSION " " SERVER_SUBVERSION
-#else
-#define SERVER_VERSION	SERVER_BASEVERSION
-#endif
+#define SERVER_VERSION "Apache/1.3b7-dev"	/* SEE COMMENTS ABOVE */
 
 API_EXPORT(const char *) ap_get_server_version(void);
 API_EXPORT(const char *) ap_get_server_built(void);
Index: main/http_config.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v
retrieving revision 1.114
diff -u -r1.114 http_config.c
--- http_config.c	1998/04/13 18:05:10	1.114
+++ http_config.c	1998/04/21 21:42:12
@@ -1314,6 +1314,8 @@
     ap_bind_address.s_addr = htonl(INADDR_ANY);
     ap_listeners = NULL;
     ap_listenbacklog = DEFAULT_LISTENBACKLOG;
+    ap_server_version = NULL;
+    ap_add_insecurity_to_server_version = 0;
 
     /* Global virtual host hash bucket pointers.  Init to null. */
     ap_init_vhost_config(p);
Index: main/http_core.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.186
diff -u -r1.186 http_core.c
--- http_core.c	1998/04/19 20:10:46	1.186
+++ http_core.c	1998/04/21 21:42:13
@@ -1832,12 +1832,12 @@
     ap_snprintf(sport, sizeof sport, "%u", (unsigned) r->server->port);
 
     if (conf->server_signature == srv_sig_withmail) {
-	return ap_pstrcat(r->pool, prefix, "<ADDRESS>" SERVER_BASEVERSION
+	return ap_pstrcat(r->pool, prefix, "<ADDRESS>" SERVER_VERSION
 	     " Server at <A HREF=\"mailto:", r->server->server_admin, "\">",
 		       r->server->server_hostname, "</A> Port ", sport,
 		       "</ADDRESS>\n", NULL);
     }
-    return ap_pstrcat(r->pool, prefix, "<ADDRESS>" SERVER_BASEVERSION
+    return ap_pstrcat(r->pool, prefix, "<ADDRESS>" SERVER_VERSION
 	     " Server at ", r->server->server_hostname, "</A> Port ", sport,
 		   "</ADDRESS>\n", NULL);
 }
@@ -1854,6 +1854,13 @@
     return NULL;
 }
 
+
+static const char *set_insecure_version_string(cmd_parms *cmd, void *dummy, int f)
+{
+    ap_add_insecurity_to_server_version = f;
+    return NULL;
+}
+
 /* Note --- ErrorDocument will now work from .htaccess files.  
  * The AllowOverride of Fileinfo allows webmasters to turn it off
  */
@@ -1985,6 +1992,8 @@
 { "LogLevel", set_loglevel, NULL, RSRC_CONF, TAKE1, "set level of verbosity in error logging"
},
 { "NameVirtualHost", ap_set_name_virtual_host, NULL, RSRC_CONF, TAKE1,
   "a numeric ip address:port, or the name of a host" },
+{ "StartServers", set_daemons_to_start, NULL, RSRC_CONF, TAKE1, "Number of child processes
launched at server startup" },
+{ "InsecureVersionString", set_insecure_version_string, NULL, RSRC_CONF, FLAG, "if you want
to advertise to the world what platform your server is, turn this on" },
 { NULL },
 };
 
@@ -2193,6 +2202,39 @@
     return OK;
 }
 
+
+API_EXPORT(void) ap_add_server_version(pool *p, const char *s)
+{
+    if (ap_server_version == NULL) {
+	ap_server_version = ap_pstrcat(p, " ", s, NULL);
+    }
+    else {
+	ap_server_version = ap_pstrcat(p, ap_server_version, " ", s, NULL);
+    }
+}
+
+static void init_core(server_rec *s, pool *p)
+{
+    if (ap_add_insecurity_to_server_version) {
+	ap_server_version = ap_pstrcat(p,
+#if defined(WIN32)
+		SERVER_VERSION " (WIN32)"
+#elif defined(__EMX__)
+		SERVER_VERSION " (OS/2)"
+#else
+		SERVER_VERSION " (UNIX)"
+#endif
+		, ap_server_version, NULL);
+    }
+    else if (ap_server_version) {
+	ap_server_version = ap_pstrcat(p, SERVER_VERSION,
+	    ap_server_version, NULL);
+    }
+    else {
+	ap_server_version = SERVER_VERSION;
+    }
+}
+
 static const handler_rec core_handlers[] = {
 { "*/*", default_handler },
 { NULL }
@@ -2200,7 +2242,7 @@
 
 API_VAR_EXPORT module core_module = {
    STANDARD_MODULE_STUFF,
-   NULL,			/* initializer */
+   init_core,			/* initializer */
    create_core_dir_config,	/* create per-directory config structure */
    merge_core_dir_configs,	/* merge per-directory config structures */
    create_core_server_config,	/* create per-server config structure */
Index: main/http_main.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.325
diff -u -r1.325 http_main.c
--- http_main.c	1998/04/19 20:10:46	1.325
+++ http_main.c	1998/04/21 21:42:15
@@ -245,7 +245,10 @@
 int ap_suexec_enabled = 0;
 int ap_listenbacklog;
 int ap_dump_settings;
+char *ap_server_version;
+int ap_add_insecurity_to_server_version;
 
+
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
  * to deal with MaxClients changes across SIGUSR1 restarts.  We use this
@@ -2953,14 +2956,8 @@
 
 static void show_compile_settings(void)
 {
-#ifdef SERVER_SUBVERSION
-    printf("Server base version: %s\n", SERVER_BASEVERSION);
-    printf("Server sub-version:  %s\n", SERVER_SUBVERSION);
-    printf("Server built:        %s\n", ap_get_server_built());
-#else
     printf("Server version: %s\n", ap_get_server_version());
     printf("Server built:   %s\n", ap_get_server_built());
-#endif
     printf("Server's Module Magic Number: %u\n", MODULE_MAGIC_NUMBER);
     printf("Server compiled with....\n");
 #ifdef BIG_SECURITY_HOLE
Index: modules/standard/mod_mime.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v
retrieving revision 1.39
diff -u -r1.39 mod_mime.c
--- mod_mime.c	1998/04/11 12:00:49	1.39
+++ mod_mime.c	1998/04/21 21:42:16
@@ -209,6 +209,8 @@
     int x;
     char *types_confname = ap_get_module_config(s->module_config, &mime_module);
 
+    ap_add_server_version(p, "mod_mime/9.9.9");
+
     if (!types_confname)
         types_confname = TYPES_CONFIG_FILE;
 
Index: modules/standard/mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.101
diff -u -r1.101 mod_rewrite.c
--- mod_rewrite.c	1998/04/11 12:00:50	1.101
+++ mod_rewrite.c	1998/04/21 21:42:17
@@ -882,6 +882,8 @@
 
 static void init_module(server_rec *s, pool *p)
 {
+    ap_add_server_version(p, "mod_rewrite/1.2.3");
+
     /* check if proxy module is available */
     proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL);
 


Mime
View raw message