From: Ryan Bloom Date: Tue, 14 Nov 2000 02:42:51 +0000 (+0000) Subject: Add the referer to the error log if one is available. X-Git-Tag: APACHE_2_0_ALPHA_8~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a75c27537d1a007fe363296b09419235323a595;p=apache Add the referer to the error log if one is available. PR: 73 Submitted by: Markus Gyger git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86951 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 6a2a8158dd..4d0499ee1e 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ Apache 2.0 STATUS: -Last modified at [$Date: 2000/11/10 18:16:51 $] +Last modified at [$Date: 2000/11/14 02:42:51 $] Release: @@ -175,10 +175,6 @@ RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP: PRs that have been suspended forever waiting for someone to put them into 'the next release': - * PR#73: mod_log-any - reporting of referer in error_log - Status: - * PR#76: general missing call to "setlocale();" Status: diff --git a/server/log.c b/server/log.c index 33dfcd455e..8d0c80989a 100644 --- a/server/log.c +++ b/server/log.c @@ -328,6 +328,7 @@ static void log_error_core(const char *file, int line, int level, char errstr[MAX_STRING_LEN]; size_t len; apr_file_t *logf = NULL; + const char *referer; if (s == NULL) { /* @@ -425,9 +426,13 @@ static void log_error_core(const char *file, int line, int level, len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, "(%d)%s: ", status, apr_strerror(status, buf, sizeof(buf))); } - len += apr_vsnprintf(errstr + len, MAX_STRING_LEN - len, fmt, args); + if (r && (referer = apr_table_get(r->headers_in, "Referer"))) { + len += apr_snprintf(errstr + len, MAX_STRING_LEN - len, + ", referer: %s", referer); + } + /* NULL if we are logging to syslog */ if (logf) { /* Truncate for the terminator (as apr_snprintf does) */