httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject SERVER_VERSION with OS
Date Mon, 20 Apr 1998 16:01:28 GMT
Here's a hacked version of Alexei's patch... it creates a static
version with the OS type tacked on... 'Course, this meant having
ap_get_server_version take an arg but....


Index: src/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/20 15:51:58
@@ -64,13 +64,17 @@
 static const char server_built[] = "unknown";
 #endif
 static const char server_version[] = SERVER_VERSION;
+static const char server_version_os[] = SERVER_VERSION " (" SERVER_OS_TYPE ")";
 
 API_EXPORT(const char *) ap_get_server_built()
 {
     return server_built;
 }
 
-API_EXPORT(const char *) ap_get_server_version()
+API_EXPORT(const char *) ap_get_server_version(int show_os_type)
 {
-    return server_version;
+    if (show_os_type) 
+	return server_version_os;
+    else
+	return server_version;
 }
Index: src/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/20 15:52:00
@@ -369,7 +369,7 @@
 #define SERVER_VERSION	SERVER_BASEVERSION
 #endif
 
-API_EXPORT(const char *) ap_get_server_version(void);
+API_EXPORT(const char *) ap_get_server_version(int send_os_type);
 API_EXPORT(const char *) ap_get_server_built(void);
 
 /* Numeric release version identifier: major minor bugfix betaseq
@@ -800,6 +800,8 @@
 
     uid_t server_uid;		/* effective user id when calling exec wrapper */
     gid_t server_gid;		/* effective group id when calling exec wrapper */
+
+    int send_os_type;		/* Send the OS type with the Server header */
 };
 
 /* These are more like real hosts than virtual hosts */
Index: src/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/20 15:52:04
@@ -1241,6 +1241,8 @@
     s->server_uid = ap_user_id;
     s->server_gid = ap_group_id;
 
+    s->send_os_type = -1;
+
     *ps = s;
 
     return ap_parse_vhost_addrs(p, hostname, s);
@@ -1283,6 +1285,10 @@
 	if (virt->send_buffer_size == 0)
 	    virt->send_buffer_size = main_server->send_buffer_size;
 
+	if (virt->send_os_type == -1)
+	    virt->send_os_type = main_server->send_os_type;
+
+
 	/* XXX: this is really something that should be dealt with by a
 	 * post-config api phase */
 	ap_core_reorder_directories(p, virt);
@@ -1339,6 +1345,7 @@
     s->keep_alive = 1;
     s->next = NULL;
     s->addrs = ap_pcalloc(p, sizeof(server_addr_rec));
+    s->send_os_type = 1;
     /* NOT virtual host; don't match any real network interface */
     s->addrs->host_addr.s_addr = htonl(INADDR_ANY);
     s->addrs->host_port = 0;	/* matches any port */
Index: src/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/20 15:52:07
@@ -1854,6 +1854,16 @@
     return NULL;
 }
 
+static const char *set_send_os_type (cmd_parms *cmd, void *dummy, int arg) 
+{
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    if (err != NULL) return err;
+
+    cmd->server->send_os_type = arg;
+    return NULL;
+}
+
+
 /* Note --- ErrorDocument will now work from .htaccess files.  
  * The AllowOverride of Fileinfo allows webmasters to turn it off
  */
@@ -1985,6 +1995,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" },
+{ "SendOSType", set_send_os_type, NULL, RSRC_CONF, FLAG,
+  "whether the OS type should be sent with the metadata for each response"},
 { NULL },
 };
 
Index: src/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/20 15:52:23
@@ -2958,7 +2958,7 @@
     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 version: %s\n", ap_get_server_version(1));
     printf("Server built:   %s\n", ap_get_server_built());
 #endif
     printf("Server's Module Magic Number: %u\n", MODULE_MAGIC_NUMBER);
@@ -3812,7 +3812,7 @@
 
 	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
 		    "%s configured -- resuming normal operations",
-		    ap_get_server_version());
+		    ap_get_server_version(1));
 	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf,
 		    "Server built: %s", ap_get_server_built());
 	restart_pending = shutdown_pending = 0;
@@ -3993,7 +3993,7 @@
 	    ap_cpystrn(ap_server_confname, optarg, sizeof(ap_server_confname));
 	    break;
 	case 'v':
-	    printf("Server version: %s\n", ap_get_server_version());
+	    printf("Server version: %s\n", ap_get_server_version(1));
 	    printf("Server built:   %s\n", ap_get_server_built());
 	    exit(0);
 	case 'V':
@@ -4031,7 +4031,7 @@
     }
 
 #ifdef __EMX__
-    printf("%s \n", ap_get_server_version());
+    printf("%s \n", ap_get_server_version(1));
 #endif
 
     ap_suexec_enabled = init_suexec();
@@ -5112,7 +5112,7 @@
 	    ap_cpystrn(ap_server_confname, optarg, sizeof(ap_server_confname));
 	    break;
 	case 'v':
-	    printf("Server version: %s\n", ap_get_server_version());
+	    printf("Server version: %s\n", ap_get_server_version(1));
 	    printf("Server built:   %s\n", ap_get_server_built());
 	    exit(0);
 	case 'V':
@@ -5133,11 +5133,11 @@
     }
 
 #ifdef __EMX__
-    printf("%s \n", ap_get_server_version());
+    printf("%s \n", ap_get_server_version(1));
 #endif
 #ifdef WIN32
     if (!child) {
-	printf("%s \n", ap_get_server_version());
+	printf("%s \n", ap_get_server_version(1));
     }
 #endif
     if (!child && run_as_service) {
Index: src/main/http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.211
diff -u -r1.211 http_protocol.c
--- http_protocol.c	1998/04/11 12:00:30	1.211
+++ http_protocol.c	1998/04/20 15:52:26
@@ -1042,7 +1042,8 @@
            protocol, " ", r->status_line, "\015\012", NULL);
 
     ap_send_header_field(r, "Date", ap_gm_timestr_822(r->pool, r->request_time));
-    ap_send_header_field(r, "Server", ap_get_server_version());
+    ap_send_header_field(r, "Server",
+           ap_get_server_version(r->server->send_os_type));
 
     ap_table_unset(r->headers_out, "Date");        /* Avoid bogosity */
     ap_table_unset(r->headers_out, "Server");
Index: src/main/util_script.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/util_script.c,v
retrieving revision 1.106
diff -u -r1.106 util_script.c
--- util_script.c	1998/04/11 12:00:32	1.106
+++ util_script.c	1998/04/20 15:52:26
@@ -242,7 +242,7 @@
 #endif
 
     ap_table_setn(e, "PATH", env_path);
-    ap_table_setn(e, "SERVER_SOFTWARE", ap_get_server_version());
+    ap_table_setn(e, "SERVER_SOFTWARE", ap_get_server_version(s->send_os_type));
     ap_table_setn(e, "SERVER_NAME", ap_get_server_name(r));
     ap_table_setn(e, "SERVER_PORT", ap_psprintf(r->pool, "%u", ap_get_server_port(r)));
     host = ap_get_remote_host(c, r->per_dir_config, REMOTE_HOST);
Index: src/modules/example/mod_example.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/example/mod_example.c,v
retrieving revision 1.29
diff -u -r1.29 mod_example.c
--- mod_example.c	1998/04/11 12:00:37	1.29
+++ mod_example.c	1998/04/20 15:52:28
@@ -529,7 +529,7 @@
     ap_rputs("  </H1>\n", r);
     ap_rputs("  <P>\n", r);
     ap_rprintf(r, "  Apache HTTP Server version: \"%s\"\n",
-	    ap_get_server_version());
+	    ap_get_server_version(r->server->send_os_type));
     ap_rputs("  <BR>\n", r);
     ap_rprintf(r, "  Server built: \"%s\"\n", ap_get_server_built());
     ap_rputs("  </P>\n", r);;
Index: src/modules/proxy/proxy_connect.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_connect.c,v
retrieving revision 1.27
diff -u -r1.27 proxy_connect.c
--- proxy_connect.c	1998/04/11 12:00:40	1.27
+++ proxy_connect.c	1998/04/20 15:52:30
@@ -204,13 +204,16 @@
 		    r->uri);
 	write(sock, buffer, strlen(buffer));
 	ap_snprintf(buffer, sizeof(buffer),
-		    "Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
+		    "Proxy-agent: %s" CRLF CRLF, 
+		    ap_get_server_version(r->server->send_os_type));
 	write(sock, buffer, strlen(buffer));
     }
     else {
 	Explain0("Returning 200 OK Status");
 	ap_rvputs(r, "HTTP/1.0 200 Connection established" CRLF, NULL);
-	ap_rvputs(r, "Proxy-agent: ", ap_get_server_version(), CRLF CRLF, NULL);
+	ap_rvputs(r, "Proxy-agent: ",
+		    ap_get_server_version(r->server->send_os_type),
+		    CRLF CRLF, NULL);
 	ap_bflush(r->connection->client);
     }
 
Index: src/modules/standard/mod_info.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_info.c,v
retrieving revision 1.40
diff -u -r1.40 mod_info.c
--- mod_info.c	1998/04/11 12:00:48	1.40
+++ mod_info.c	1998/04/20 15:52:38
@@ -401,7 +401,7 @@
         if (!r->args || !strcasecmp(r->args, "server")) {
             ap_rprintf(r, "<a name=\"server\"><strong>Server Version:</strong>
"
                         "<font size=+1><tt>%s</tt></a></font><br>\n",
-                        ap_get_server_version());
+                        ap_get_server_version(r->server->send_os_type));
             ap_rprintf(r, "<strong>Server Built:</strong> "
                         "<font size=+1><tt>%s</tt></a></font><br>\n",
                         ap_get_server_built());
Index: src/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/20 15:52:55
@@ -3334,7 +3334,7 @@
         result = r->protocol;
     }
     else if (strcasecmp(var, "SERVER_SOFTWARE") == 0) {
-        result = ap_get_server_version();
+        result = ap_get_server_version(r->server->send_os_type);
     }
     else if (strcasecmp(var, "API_VERSION") == 0) { /* non-standard */
         ap_snprintf(resultbuf, sizeof(resultbuf), "%d", MODULE_MAGIC_NUMBER);
Index: src/modules/standard/mod_status.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_status.c,v
retrieving revision 1.85
diff -u -r1.85 mod_status.c
--- mod_status.c	1998/04/11 12:00:51	1.85
+++ mod_status.c	1998/04/20 15:52:57
@@ -325,7 +325,8 @@
 	ap_rputs("<HTML><HEAD>\n<TITLE>Apache Status</TITLE>\n</HEAD><BODY>\n",
r);
 	ap_rputs("<H1>Apache Server Status for ", r);
 	ap_rvputs(r, server->server_hostname, "</H1>\n\n", NULL);
-	ap_rvputs(r, "Server Version: ", ap_get_server_version(), "<br>\n",
+	ap_rvputs(r, "Server Version: ",
+	       ap_get_server_version(r->server->send_os_type), "<br>\n",
 	       NULL);
 	ap_rvputs(r, "Server Built: ", ap_get_server_built(), "<br>\n<hr>\n",
 	       NULL);
Index: src/os/bs2000/os.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/os/bs2000/os.h,v
retrieving revision 1.7
diff -u -r1.7 os.h
--- os.h	1998/04/13 18:05:17	1.7
+++ os.h	1998/04/20 15:52:58
@@ -27,4 +27,6 @@
  * to use request_rec here... */
 struct request_rec;
 extern int ap_checkconv(struct request_rec *r);
+
+#define SERVER_OS_TYPE "Unix"
 #endif /*AP_OS_BS2000_OS_H*/
Index: src/os/emx/os.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/os/emx/os.h,v
retrieving revision 1.4
diff -u -r1.4 os.h
--- os.h	1998/04/13 18:05:18	1.4
+++ os.h	1998/04/20 15:52:58
@@ -21,3 +21,5 @@
 
 /* OS/2 doesn't have symlinks so S_ISLNK is always false */
 #define S_ISLNK(m) 0
+
+#define SERVER_OS_TYPE "OS/2"
Index: src/os/unix/os.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/os/unix/os.h,v
retrieving revision 1.21
diff -u -r1.21 os.h
--- os.h	1998/04/13 18:05:19	1.21
+++ os.h	1998/04/20 15:52:58
@@ -125,4 +125,6 @@
 void *      ap_os_dso_sym(void *, const char *);
 const char *ap_os_dso_error(void);
 
+#define SERVER_OS_TYPE "Unix"
+
 #endif	/* !APACHE_OS_H */
Index: src/os/win32/os.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/os/win32/os.h,v
retrieving revision 1.17
diff -u -r1.17 os.h
--- os.h	1998/04/13 18:05:20	1.17
+++ os.h	1998/04/20 15:52:58
@@ -106,3 +106,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 */
+
+#define SERVER_OS_TYPE "Win32"

-- 
===========================================================================
   Jim Jagielski   |||   jim@jaguNET.com   |||   http://www.jaguNET.com/
            "That's no ordinary rabbit... that's the most foul,
            cruel and bad-tempered rodent you ever laid eyes on"

Mime
View raw message