httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@leland.Stanford.EDU>
Subject Re: SERVER_VERSION
Date Thu, 16 Apr 1998 04:36:04 GMT
On Wed, 15 Apr 1998, Marc Slemko wrote:

> But, either way, I wouldn't worry to much about that.  The way it looks to
> me is that (after b6 goes out) if someone does the work to do a
> Unix/Win32 and perhaps OS/2 solution then there is the support to put it
> in.

How about this (plus appropriate documentation):

Index: include/httpd.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.205
diff -u -r1.205 httpd.h
--- httpd.h	1998/04/16 00:19:39	1.205
+++ httpd.h	1998/04/16 04:33:34
@@ -796,6 +796,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: 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/16 04:33:34
@@ -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: main/http_core.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.183
diff -u -r1.183 http_core.c
--- http_core.c	1998/04/13 18:05:11	1.183
+++ http_core.c	1998/04/16 04:33:35
@@ -1850,6 +1850,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
  */
@@ -1981,6 +1991,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: 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/16 04:33:35
@@ -1042,7 +1042,14 @@
            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());
+#ifdef SERVER_OS_TYPE
+#define SERVER_OS_COMMENT " (" SERVER_OS_TYPE ")"
+    if (r->server->send_os_type)
+	ap_send_header_field(r, "Server", ap_pstrcat(r->pool, ap_get_server_version(),
+						  SERVER_OS_COMMENT, NULL));
+    else
+#endif
+	ap_send_header_field(r, "Server", ap_get_server_version());
 
     ap_table_unset(r->headers_out, "Date");        /* Avoid bogosity */
     ap_table_unset(r->headers_out, "Server");
Index: 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/16 04:33:37
@@ -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: 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/16 04:33:37
@@ -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"
\ No newline at end of file
Index: 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/16 04:33:38
@@ -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: 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/16 04:33:38
@@ -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"


-- Alexei Kosut <akosut@stanford.edu> <http://www.stanford.edu/~akosut/>
   Stanford University, Class of 2001 * Apache <http://www.apache.org> *





Mime
View raw message