You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Tony Finch <do...@dotat.at> on 1999/01/16 18:08:56 UTC
[PATCH] Re: cvs commit: apache-1.3/htdocs/manual/vhosts mass.html
Tony Finch <do...@dotat.at> wrote:
>
>> <P>The main disadvantage is that you cannot have a different log file
>> for each server; however if you have very many virtual hosts then
>> doing this is dubious anyway because it eats file descriptors. It's
>> better to log to a pipe or a fifo and arrange for the process at the
>> other end to distribute the logs (and perhaps accumulate statistics,
>> etc.). A <CODE>LogFormat</CODE> directive that includes
>> <CODE>%v</CODE> for the virtual host makes it easy to do this.</P>
>
>I just realised that this is wrong: the %v won't work on 1.3.4 because
>it always uses the canonical server name. It should be changed to
>%{SERVER_NAME}e.
No it shouldn't, because the environment variables only get set if you
have been through mod_cgi or mod_include. Damn. I include a patch that
allows you to get both the 1.3.3 behaviour of %v and the 1.3.4
behaviour as %V. There's also a few corrections to mass.html.
Tony.
--
f.a.n.finch dot@dotat.at fanf@demon.net
Index: src/modules/standard/mod_log_config.c
===================================================================
RCS file: /a/cvsroot/src/www/apache_1-3_fanf/src/modules/standard/mod_log_config.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 mod_log_config.c
--- mod_log_config.c 1999/01/12 13:02:29 1.1.1.3
+++ mod_log_config.c 1999/01/16 17:04:24
@@ -138,7 +138,8 @@
* %...T: the time taken to serve the request, in seconds.
* %...u: remote user (from auth; may be bogus if return status (%s) is 401)
* %...U: the URL path requested.
- * %...v: the name of the server (i.e. which virtual host?)
+ * %...V: the configured name of the server (i.e. which virtual host?)
+ * %...v: the server name according to the UseCanonicalName setting
*
* The '...' can be nothing at all (e.g. "%h %u %r %s %b"), or it can
* indicate conditions for inclusion of the item (which will cause it
@@ -416,6 +417,14 @@
r->server->port ? r->server->port : ap_default_port(r));
}
+/* This respects the setting of UseCanonicalName so that
+ * the dynamic mass virtual hosting trick works better.
+ */
+static const char *log_server_name(request_rec *r, char *a)
+{
+ return ap_get_server_name(r);
+}
+
static const char *log_child_pid(request_rec *r, char *a)
{
return ap_psprintf(r->pool, "%ld", (long) getpid());
@@ -478,7 +487,10 @@
'e', log_env_var, 0
},
{
- 'v', log_virtual_host, 0
+ 'v', log_server_name, 0
+ },
+ {
+ 'V', log_virtual_host, 0
},
{
'p', log_server_port, 0
Index: htdocs/manual/mod/mod_log_config.html
===================================================================
RCS file: /a/cvsroot/src/www/apache_1-3_fanf/htdocs/manual/mod/mod_log_config.html,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mod_log_config.html
--- mod_log_config.html 1998/11/23 17:08:58 1.1.1.1
+++ mod_log_config.html 1999/01/16 17:04:25
@@ -133,7 +133,8 @@
%...T: The time taken to serve the request, in seconds.
%...u: Remote user (from auth; may be bogus if return status (%s) is 401)
%...U: The URL path requested.
-%...v: The canonical ServerName of the server serving the request.
+%...V: The canonical ServerName of the server serving the request.
+%...v: The server name according to the UseCanonicalName setting.
</PRE>
The `...' can be nothing at all (<EM>e.g.</EM>, <CODE>"%h %u %r %s %b"</CODE>), or it can
Index: htdocs/manual/vhost/mass.html
===================================================================
RCS file:
/a/cvsroot/src/www/apache_1-3_fanf/htdocs/manual/vhost/mass.html,v
retrieving revision 1.2
diff -u -r1.2 mass.html
--- mass.html 1999/01/15 12:34:56 1.2
+++ mass.html 1999/01/15 16:36:03
@@ -206,11 +206,11 @@
RewriteCond %{REQUEST_URI} !^/cgi-bin/
# check the hostname is right so that the RewriteRule works
-RewriteCond ${lowercase:%{HTTP_HOST}} ^www\.[a-z-]+\.isp\.com$
+RewriteCond ${lowercase:%{SERVER_NAME}} ^www\.[a-z-]+\.isp\.com$
# concatenate the virtual host name onto the start of the URI
# the [C] means do the next rewrite on the result of this one
-RewriteRule ^(.+) ${lowercase:%{HTTP_HOST}}$1 [C]
+RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
# now create the real file name
RewriteRule ^www\.([a-z-]+)\.isp\.com/(.*) /home/$1/$2
@@ -317,6 +317,14 @@
</PRE>
-<HR>
-
-<H3 ALIGN="CENTER">
- Apache HTTP Server Version 1.3
-</H3>
-
-<A HREF="./"><IMG SRC="../images/index.gif" ALT="Index"></A>
-<A HREF="../"><IMG SRC="../images/home.gif" ALT="Home"></A>
-
+<!--#include virtual="footer.html" -->
</BODY>
</HTML>