coar 99/02/19 16:13:29
Modified: src CHANGES
src/modules/standard mod_log_config.c
htdocs/manual/mod mod_log_config.html
Log:
Remove the ReferIgnore directive from mod_log_config (Dean's veto).
Get rid of the array for the 'env=' clause, since it only takes
a single variable name; use a char * instead. Check for conditional
envars by seeing if the condition string is non-NULL rather than
using a separate Boolean cell.
Revision Changes Path
1.1253 +3 -3 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1252
retrieving revision 1.1253
diff -u -r1.1252 -r1.1253
--- CHANGES 1999/02/19 16:25:33 1.1252
+++ CHANGES 1999/02/20 00:13:21 1.1253
@@ -10,9 +10,9 @@
characters in the range 0x80 to 0xff (for example accented characters).
[Paul Sutton] PR#3890
- *) Added RefererIgnore and conditional logging based upon environment
- variables to mod_log_config. mod_log_referer and mod_log_agent
- are now deprecated.[Ken Coar]
+ *) Added conditional logging based upon environment variables to
+ mod_log_config. mod_log_referer and mod_log_agent
+ are now deprecated. [Ken Coar]
*) Allow apache acting as a proxy server to relay the real
reason of a failure to a client rather than the "internal
1.75 +20 -65 apache-1.3/src/modules/standard/mod_log_config.c
Index: mod_log_config.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- mod_log_config.c 1999/02/18 19:28:21 1.74
+++ mod_log_config.c 1999/02/20 00:13:27 1.75
@@ -106,8 +106,8 @@
* CustomLog logs/referer "%{referer}i -> %U"
* CustomLog logs/agent "%{user-agent}i"
*
- * Except: no RefererIgnore functionality
- * logs '-' if no Referer or User-Agent instead of nothing
+ * RefererIgnore functionality can be obtained with conditional
+ * logging (SetEnvIf and CustomLog ... env=!VAR).
*
* But using this method allows much easier modification of the
* log format, e.g. to log hosts along with UA:
@@ -219,8 +219,6 @@
array_header *config_logs;
array_header *server_config_logs;
table *formats;
- int ignore_referers;
- array_header *referer_list;
} multi_log_state;
/*
@@ -237,8 +235,7 @@
char *format_string;
array_header *format;
int log_fd;
- int conditions;
- array_header *condition_list;
+ char *condition_var;
#ifdef BUFFERED_LOGS
int outcnt;
char outbuf[LOG_BUFSIZE];
@@ -693,6 +690,7 @@
int i;
int len = 0;
array_header *format;
+ char *envar;
if (cls->fname == NULL) {
return DECLINED;
@@ -702,19 +700,16 @@
* See if we've got any conditional envariable-controlled logging
decisions
* to make.
*/
- if (cls->conditions != 0) {
- char **candidates = (char **) cls->condition_list->elts;
- for (i = 0; i < cls->condition_list->nelts; ++i) {
- char *envname = candidates[i];
- if (*envname != '!') {
- if (ap_table_get(r->subprocess_env, envname) == NULL) {
- return DECLINED;
- }
+ if (cls->condition_var != NULL) {
+ envar = cls->condition_var;
+ if (*envar != '!') {
+ if (ap_table_get(r->subprocess_env, envar) == NULL) {
+ return DECLINED;
}
- else {
- if (ap_table_get(r->subprocess_env, &envname[1]) != NULL) {
- return DECLINED;
- }
+ }
+ else {
+ if (ap_table_get(r->subprocess_env, &envar[1]) != NULL) {
+ return DECLINED;
}
}
}
@@ -781,22 +776,8 @@
config_log_state *clsarray;
int i;
- /*
- * See if there are any Referer: values we're supposed to ignore.
- */
- if (mls->ignore_referers != 0) {
- const char *referer = ap_table_get(r->headers_in, "Referer");
- if (referer != NULL) {
- char **candidate = (char **) mls->referer_list->elts;
- for (i = 0; i < mls->referer_list->nelts; ++i) {
- if (strstr(referer, candidate[i]) != NULL) {
- return DECLINED;
- }
- }
- }
- }
/*
- * Continue and log this transaction..
+ * Log this transaction..
*/
if (mls->config_logs->nelts) {
clsarray = (config_log_state *) mls->config_logs->elts;
@@ -834,8 +815,6 @@
mls->server_config_logs = NULL;
mls->formats = ap_make_table(p, 4);
ap_table_setn(mls->formats, "CLF", DEFAULT_LOG_FORMAT);
- mls->ignore_referers = 0;
- mls->referer_list = NULL;
return mls;
}
@@ -857,12 +836,6 @@
add->default_format = base->default_format;
}
add->formats = ap_overlay_tables(p, base->formats, add->formats);
- add->ignore_referers = (add->ignore_referers != 0)
- ? add->ignore_referers
- : base->ignore_referers;
- if (base->ignore_referers != 0) {
- ap_array_cat(add->referer_list, base->referer_list);
- }
return add;
}
@@ -895,21 +868,6 @@
return err_string;
}
-static const char *add_referer_ignore(cmd_parms *cmd, void *mconfig,
- char *word1)
-{
- multi_log_state *mls = ap_get_module_config(cmd->server->module_config,
- &config_log_module);
- char **ignore_uri;
-
- mls->ignore_referers++;
- if (mls->referer_list == NULL) {
- mls->referer_list = ap_make_array(cmd->pool, 4, sizeof(char *));
- }
- ignore_uri = (char **) ap_push_array(mls->referer_list);
- *ignore_uri = ap_pstrdup(cmd->pool, word1);
- return NULL;
-}
static const char *add_custom_log(cmd_parms *cmd, void *dummy, char *fn,
char *fmt, char *envclause)
@@ -920,17 +878,16 @@
config_log_state *cls;
cls = (config_log_state *) ap_push_array(mls->config_logs);
- cls->conditions = 0;
+ cls->condition_var = NULL;
if (envclause != NULL) {
- char **env_condition;
-
if (strncasecmp(envclause, "env=", 4) != 0) {
return "error in condition clause";
+ }
+ if ((envclause[4] == '\0')
+ || ((envclause[4] == '!') && (envclause[5] == '\0'))) {
+ return "missing environment variable name";
}
- cls->condition_list = ap_make_array(cmd->pool, 4, sizeof(char *));
- env_condition = (char **) ap_push_array(cls->condition_list);
- *env_condition = ap_pstrdup(cmd->pool, &envclause[4]);
- cls->conditions++;
+ cls->condition_var = ap_pstrdup(cmd->pool, &envclause[4]);
}
cls->fname = fn;
@@ -967,8 +924,6 @@
"a log format string (see docs) and an optional format name"},
{"CookieLog", set_cookie_log, NULL, RSRC_CONF, TAKE1,
"the filename of the cookie log"},
- {"RefererIgnore", add_referer_ignore, NULL, RSRC_CONF, ITERATE,
- "referer URLs to ignore"},
{NULL}
};
1.30 +4 -54 apache-1.3/htdocs/manual/mod/mod_log_config.html
Index: mod_log_config.html
===================================================================
RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_log_config.html,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- mod_log_config.html 1999/02/17 23:28:11 1.29
+++ mod_log_config.html 1999/02/20 00:13:29 1.30
@@ -54,13 +54,11 @@
basis.
<LI>Beginning with Apache 1.3.5, the mod_log_config module has
-also subsumed the <CODE>RefererIgnore</CODE> directive from
-<A HREF="mod_log_referer.html">mod_log_referer</A>. The use
-of <CODE>RefererIgnore</CODE> is deprecated, and should be
-replaced by combinations of
+also subsumed the <CODE>RefererIgnore</CODE> functionality from
+<A HREF="mod_log_referer.html">mod_log_referer</A>. The effect
+of <CODE>RefererIgnore</CODE> can be achieved by combinations of
<A HREF="mod_setenvif.html"><CODE>SetEnvIf</CODE></A> directives
-and environment variable controlled <CODE>CustomLog</CODE>
-definitions.
+and conditional <CODE>CustomLog</CODE> definitions.
</UL>
@@ -214,7 +212,6 @@
<LI><A HREF="#customlog">CustomLog</A>
<LI><A HREF="#customlog-conditional">CustomLog (conditional)</A>
<LI><A HREF="#logformat">LogFormat</A>
-<LI><A HREF="#refererignore">RefererIgnore</A>
<LI><A HREF="#transferlog">TransferLog</A>
</UL>
<HR>
@@ -401,53 +398,6 @@
</P>
<HR>
-<H2><A NAME="refererignore">RefererIgnore</A></H2>
-<A
- HREF="directive-dict.html#Syntax"
- REL="Help"
-><STRONG>Syntax:</STRONG></A> RefererIgnore <EM>string string ...</EM><BR>
-<A
- HREF="directive-dict.html#Context"
- REL="Help"
-><STRONG>Context:</STRONG></A> server config, virtual host<BR>
-<A
- HREF="directive-dict.html#Status"
- REL="Help"
-><STRONG>Status:</STRONG></A> Base<BR>
-<A
- HREF="directive-dict.html#Compatibility"
- REL="Help"
-><STRONG>Compatibility:</STRONG></A>> Only available in Apache 1.3.5
- or later
-<BR>
-<A
- HREF="directive-dict.html#Module"
- REL="Help"
-><STRONG>Module:</STRONG></A> mod_log_config
-
-<P>
-The RefererIgnore directive adds to the list of strings to ignore in
-Referer headers. If any of the strings in the list is contained in
-the Referer header, then no referrer information will be logged for the
-request. Example:
-</P>
-<PRE>
- RefererIgnore www.ncsa.uiuc.edu
-</PRE>
-<P>
-will avoid logging references from www.ncsa.uiuc.edu.
-</P>
-<P>
-<STRONG>Note:</STRONG> <EM>All</EM> transaction logfiles
-(defined by <CODE>CustomLog</CODE> or <CODE>TransferLog</CODE>) in
-the same server scope as the <CODE>RefererIgnore</CODE> (<EM>e.g.</EM>,
-in the same <CODE><VirtualHost></CODE> container)
-are affected by
-this directive. If you want to control this behaviour on a
-<EM>per</EM>-logfile basis, you should use the
-<A HREF="#customlog-conditional">conditional <SAMP>CustomLog</SAMP></A>
-capability.
-</P>
<HR>
<H2><A NAME="transferlog">TransferLog</A></H2>