Index: server/mpm/winnt/service.c =================================================================== --- server/mpm/winnt/service.c (revision 440616) +++ server/mpm/winnt/service.c (working copy) @@ -436,7 +436,7 @@ /* Time to fix up the description, upon each successful restart */ - full_description = ap_get_server_version(); + full_description = ap_get_server_description(); if ((osver.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osver.dwMajorVersion > 4) Index: server/mpm/winnt/mpm_winnt.c =================================================================== --- server/mpm/winnt/mpm_winnt.c (revision 440616) +++ server/mpm/winnt/mpm_winnt.c (working copy) @@ -1668,7 +1668,7 @@ /* A real-honest to goodness parent */ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, "%s configured -- resuming normal operations", - ap_get_server_version()); + ap_get_server_description()); ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, "Server built: %s", ap_get_server_built()); Index: server/mpm/mpmt_os2/mpmt_os2.c =================================================================== --- server/mpm/mpmt_os2/mpmt_os2.c (revision 440616) +++ server/mpm/mpmt_os2/mpmt_os2.c (working copy) @@ -207,7 +207,7 @@ int listener_num, num_listeners, slot; ULONG rc; - printf("%s \n", ap_get_server_version()); + printf("%s \n", ap_get_server_description()); set_signals(); if (ap_setup_listeners(ap_server_conf) < 1) { @@ -270,7 +270,7 @@ ap_scoreboard_image->global->restart_time = apr_time_now(); ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, "%s configured -- resuming normal operations", - ap_get_server_version()); + ap_get_server_description()); ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf, "Server built: %s", ap_get_server_built()); #ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH Index: server/mpm/netware/mpm_netware.c =================================================================== --- server/mpm/netware/mpm_netware.c (revision 440616) +++ server/mpm/netware/mpm_netware.c (working copy) @@ -723,7 +723,7 @@ request_count = 0; ClearScreen (getscreenhandle()); - printf("%s \n", ap_get_server_version()); + printf("%s \n", ap_get_server_description()); for (i=0;iserver_signature == srv_sig_withmail) { return apr_pstrcat(r->pool, prefix, "
", - ap_get_server_version(), + ap_get_server_banner(), " Server at server->server_admin) ? "" : "mailto:", ap_escape_html(r->pool, r->server->server_admin), @@ -2671,7 +2671,7 @@ "
\n", NULL); } - return apr_pstrcat(r->pool, prefix, "
", ap_get_server_version(), + return apr_pstrcat(r->pool, prefix, "
", ap_get_server_banner(), " Server at ", ap_escape_html(r->pool, ap_get_server_name(r)), " Port ", sport, @@ -2699,8 +2699,9 @@ * string. */ -static char *server_version = NULL; -static int version_locked = 0; +static char *server_banner = NULL; +static int banner_locked = 0; +static char *server_description = NULL; enum server_token_type { SrvTk_MAJOR, /* eg: Apache/2 */ @@ -2712,11 +2713,12 @@ }; static enum server_token_type ap_server_tokens = SrvTk_FULL; -static apr_status_t reset_version(void *dummy) +static apr_status_t reset_banner(void *dummy) { - version_locked = 0; + banner_locked = 0; ap_server_tokens = SrvTk_FULL; - server_version = NULL; + server_banner = NULL; + server_description = NULL; return APR_SUCCESS; } @@ -2728,40 +2730,56 @@ version->add_string = AP_SERVER_ADD_STRING; } +AP_DECLARE(const char *) ap_get_server_description(void) +{ + return server_description ? server_description : + AP_SERVER_BASEVERSION " (" PLATFORM ")"; +} + +AP_DECLARE(const char *) ap_get_server_banner(void) +{ + return server_banner ? server_banner : AP_SERVER_BASEVERSION; +} + +/* ap_get_server_version() is deprecated. ap_get_server_banner() + * provides the same semantics. + */ AP_DECLARE(const char *) ap_get_server_version(void) { - return (server_version ? server_version : AP_SERVER_BASEVERSION); + return ap_get_server_banner(); } AP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *component) { - if (! version_locked) { + if (! banner_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) { - apr_pool_cleanup_register(pconf, NULL, reset_version, + if (server_banner == NULL) { + apr_pool_cleanup_register(pconf, NULL, reset_banner, apr_pool_cleanup_null); - server_version = apr_pstrdup(pconf, component); + server_banner = apr_pstrdup(pconf, component); } else { /* * Tack the given component identifier to the end of * the existing string. */ - server_version = apr_pstrcat(pconf, server_version, " ", - component, NULL); + server_banner = apr_pstrcat(pconf, server_banner, " ", + component, NULL); } } + server_description = apr_pstrcat(pconf, server_description, " ", + component, NULL); } /* - * This routine adds the real server base identity to the version string, + * This routine adds the real server base identity to the banner string, * and then locks out changes until the next reconfig. */ -static void ap_set_version(apr_pool_t *pconf) +static void set_banner(apr_pool_t *pconf) { if (ap_server_tokens == SrvTk_PRODUCT_ONLY) { ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT); @@ -2780,12 +2798,13 @@ } /* - * Lock the server_version string if we're not displaying + * Lock the server_banner string if we're not displaying * the full set of tokens */ if (ap_server_tokens != SrvTk_FULL) { - version_locked++; + banner_locked++; } + server_description = AP_SERVER_BASEVERSION " (" PLATFORM ")"; } static const char *set_serv_tokens(cmd_parms *cmd, void *dummy, @@ -3756,7 +3775,7 @@ logio_add_bytes_out = APR_RETRIEVE_OPTIONAL_FN(ap_logio_add_bytes_out); ident_lookup = APR_RETRIEVE_OPTIONAL_FN(ap_ident_lookup); - ap_set_version(pconf); + set_banner(pconf); ap_setup_make_content_type(pconf); return OK; } Index: server/mpm_common.c =================================================================== --- server/mpm_common.c (revision 440616) +++ server/mpm_common.c (working copy) @@ -635,7 +635,7 @@ * requests in their logs. */ srequest = apr_pstrcat(p, "GET / HTTP/1.0\r\nUser-Agent: ", - ap_get_server_version(), + ap_get_server_banner(), " (internal dummy connection)\r\n\r\n", NULL); /* Since some operating systems support buffering of data or entire Index: server/util_script.c =================================================================== --- server/util_script.c (revision 440616) +++ server/util_script.c (working copy) @@ -223,7 +223,7 @@ #endif apr_table_addn(e, "SERVER_SIGNATURE", ap_psignature("", r)); - apr_table_addn(e, "SERVER_SOFTWARE", ap_get_server_version()); + apr_table_addn(e, "SERVER_SOFTWARE", ap_get_server_banner()); apr_table_addn(e, "SERVER_NAME", ap_escape_html(r->pool, ap_get_server_name(r))); apr_table_addn(e, "SERVER_ADDR", r->connection->local_ip); /* Apache */ Index: server/main.c =================================================================== --- server/main.c (revision 440616) +++ server/main.c (working copy) @@ -88,7 +88,7 @@ static void show_compile_settings(void) { - printf("Server version: %s\n", ap_get_server_version()); + printf("Server version: %s\n", ap_get_server_description()); printf("Server built: %s\n", ap_get_server_built()); printf("Server's Module Magic Number: %u:%u\n", MODULE_MAGIC_NUMBER_MAJOR, MODULE_MAGIC_NUMBER_MINOR); @@ -549,7 +549,7 @@ break; case 'v': - printf("Server version: %s\n", ap_get_server_version()); + printf("Server version: %s\n", ap_get_server_description()); printf("Server built: %s\n", ap_get_server_built()); destroy_and_exit_process(process, 0); Index: CHANGES =================================================================== --- CHANGES (revision 440616) +++ CHANGES (working copy) @@ -1,6 +1,12 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.4 + *) The full server version information is now included in the error log at + startup as well as server status reports, irrespective of the setting + of the ServerTokens directive. ap_get_server_version() is now + deprecated, and is replaced by ap_get_server_banner() and + ap_get_server_description(). [Jeff Trawick] + *) mod_proxy_balancer: Workers can now be defined as "hot standby" which will only be used if all other workers are unusable (eg: in error or disabled). Also, the balancer-manager displays the election Index: modules/http/http_filters.c =================================================================== --- modules/http/http_filters.c (revision 440616) +++ modules/http/http_filters.c (working copy) @@ -737,7 +737,7 @@ } } else { - form_header_field(&h, "Server", ap_get_server_version()); + form_header_field(&h, "Server", ap_get_server_banner()); } /* unset so we don't send them again */ Index: modules/proxy/mod_proxy_balancer.c =================================================================== --- modules/proxy/mod_proxy_balancer.c (revision 440616) +++ modules/proxy/mod_proxy_balancer.c (working copy) @@ -639,7 +639,7 @@ ap_rputs("

Load Balancer Manager for ", r); ap_rvputs(r, ap_get_server_name(r), "

\n\n", NULL); ap_rvputs(r, "
Server Version: ", - ap_get_server_version(), "
\n", NULL); + ap_get_server_description(), "\n", NULL); ap_rvputs(r, "
Server Built: ", ap_get_server_built(), "\n
\n", NULL); balancer = (proxy_balancer *)conf->balancers->elts; Index: modules/proxy/mod_proxy_connect.c =================================================================== --- modules/proxy/mod_proxy_connect.c (revision 440616) +++ modules/proxy/mod_proxy_connect.c (working copy) @@ -224,7 +224,7 @@ "CONNECT %s HTTP/1.0" CRLF, r->uri); apr_socket_send(sock, buffer, &nbytes); nbytes = apr_snprintf(buffer, sizeof(buffer), - "Proxy-agent: %s" CRLF CRLF, ap_get_server_version()); + "Proxy-agent: %s" CRLF CRLF, ap_get_server_banner()); apr_socket_send(sock, buffer, &nbytes); } else { @@ -235,7 +235,7 @@ ap_xlate_proto_to_ascii(buffer, nbytes); apr_socket_send(client_socket, buffer, &nbytes); nbytes = apr_snprintf(buffer, sizeof(buffer), - "Proxy-agent: %s" CRLF CRLF, ap_get_server_version()); + "Proxy-agent: %s" CRLF CRLF, ap_get_server_banner()); ap_xlate_proto_to_ascii(buffer, nbytes); apr_socket_send(client_socket, buffer, &nbytes); #if 0 @@ -244,7 +244,7 @@ */ r->status = HTTP_OK; r->header_only = 1; - apr_table_set(r->headers_out, "Proxy-agent: %s", ap_get_server_version()); + apr_table_set(r->headers_out, "Proxy-agent: %s", ap_get_server_banner()); ap_rflush(r); #endif } Index: modules/proxy/mod_proxy_ftp.c =================================================================== --- modules/proxy/mod_proxy_ftp.c (revision 440616) +++ modules/proxy/mod_proxy_ftp.c (working copy) @@ -1662,7 +1662,7 @@ apr_rfc822_date(dates, r->request_time); apr_table_setn(r->headers_out, "Date", dates); - apr_table_setn(r->headers_out, "Server", ap_get_server_version()); + apr_table_setn(r->headers_out, "Server", ap_get_server_banner()); /* set content-type */ if (dirlisting) { Index: modules/experimental/mod_example.c =================================================================== --- modules/experimental/mod_example.c (revision 440616) +++ modules/experimental/mod_example.c (working copy) @@ -546,7 +546,7 @@ ap_rputs(" \n", r); ap_rputs("

\n", r); ap_rprintf(r, " Apache HTTP Server version: \"%s\"\n", - ap_get_server_version()); + ap_get_server_banner()); ap_rputs("
\n", r); ap_rprintf(r, " Server built: \"%s\"\n", ap_get_server_built()); ap_rputs("

\n", r);; Index: modules/ssl/ssl_engine_vars.c =================================================================== --- modules/ssl/ssl_engine_vars.c (revision 440616) +++ modules/ssl/ssl_engine_vars.c (working copy) @@ -192,7 +192,7 @@ if (strlen(var) > 12 && strcEQn(var, "SSL_VERSION_", 12)) result = ssl_var_lookup_ssl_version(p, var+12); else if (strcEQ(var, "SERVER_SOFTWARE")) - result = ap_get_server_version(); + result = ap_get_server_banner(); else if (strcEQ(var, "API_VERSION")) { result = apr_itoa(p, MODULE_MAGIC_NUMBER); resdup = FALSE; Index: modules/mappers/mod_rewrite.c =================================================================== --- modules/mappers/mod_rewrite.c (revision 440616) +++ modules/mappers/mod_rewrite.c (working copy) @@ -2003,7 +2003,7 @@ case 'S': if (!strcmp(var, "SERVER_SOFTWARE")) { - result = ap_get_server_version(); + result = ap_get_server_banner(); } break; } Index: modules/generators/mod_status.c =================================================================== --- modules/generators/mod_status.c (revision 440616) +++ modules/generators/mod_status.c (working copy) @@ -397,7 +397,7 @@ ap_rputs("

Apache Server Status for ", r); ap_rvputs(r, ap_get_server_name(r), "

\n\n", NULL); ap_rvputs(r, "
Server Version: ", - ap_get_server_version(), "
\n", NULL); + ap_get_server_description(), "\n", NULL); ap_rvputs(r, "
Server Built: ", ap_get_server_built(), "\n

\n", NULL); ap_rvputs(r, "
Current Time: ", Index: modules/generators/mod_info.c =================================================================== --- modules/generators/mod_info.c (revision 440616) +++ modules/generators/mod_info.c (working copy) @@ -346,7 +346,7 @@ ap_rprintf(r, "
Server Version: " "%s
\n", - ap_get_server_version()); + ap_get_server_description()); ap_rprintf(r, "
Server Built: " "%s
\n", Index: modules/arch/netware/mod_nw_ssl.c =================================================================== --- modules/arch/netware/mod_nw_ssl.c (revision 440616) +++ modules/arch/netware/mod_nw_ssl.c (working copy) @@ -1074,7 +1074,7 @@ /* XXX-Can't get specific SSL info from NetWare */ /*result = ssl_var_lookup_ssl_version(p, var+12);*/ else if (strcEQ(var, "SERVER_SOFTWARE")) - result = ap_get_server_version(); + result = ap_get_server_banner(); else if (strcEQ(var, "API_VERSION")) { result = apr_itoa(p, MODULE_MAGIC_NUMBER); resdup = FALSE; Index: include/ap_mmn.h =================================================================== --- include/ap_mmn.h (revision 440616) +++ include/ap_mmn.h (working copy) @@ -111,6 +111,8 @@ * proxy_server (minor) * 20051115.2 (2.2.2) added inreslist member to proxy_conn_rec (minor) * 20051115.3 (2.2.3) Added server_scheme member to server_rec (minor) + * 20051115.4 (2.2.4) Added ap_get_server_banner() and + * ap_get_server_description() (minor) */ #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */ @@ -118,7 +120,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20051115 #endif -#define MODULE_MAGIC_NUMBER_MINOR 3 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 4 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a Index: include/httpd.h =================================================================== --- include/httpd.h (revision 440616) +++ include/httpd.h (working copy) @@ -420,13 +420,33 @@ AP_DECLARE(void) ap_get_server_revision(ap_version_t *version); /** - * Get the server version string + * Get the server version string, as controlled by the ServerTokens directive * @return The server version string + * @deprecated @see ap_get_server_banner() and ap_get_server_description() */ AP_DECLARE(const char *) ap_get_server_version(void); /** - * Add a component to the version string + * Get the server banner in a form suitable for sending over the + * network, with the level of information controlled by the + * ServerTokens directive. + * @return The server banner + */ +AP_DECLARE(const char *) ap_get_server_banner(void); + +/** + * Get the server description in a form suitable for local displays, + * status reports, or logging. This includes the detailed server + * version and information about some modules. It is not affected + * by the ServerTokens directive. + * @return The server description + */ +AP_DECLARE(const char *) ap_get_server_description(void); + +/** + * Add a component to the server description and banner strings + * (The latter is returned by the deprecated function + * ap_get_server_version().) * @param pconf The pool to allocate the component from * @param component The string to add */