DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=29449>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=29449 Limit length of specified fields in LogFormat Summary: Limit length of specified fields in LogFormat Product: Apache httpd-2.0 Version: 2.0.49 Platform: All OS/Version: All Status: NEW Severity: Enhancement Priority: Other Component: mod_log_config AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] The following patch enhances mod_log_config in order to allow substitutions such as "%.200U" in order to limit the impact on access logs of the enormous HTTP requests which are floating around these days. It is strictly upwards compatible as far as I can see, and has minimal performance impact. The .<ddd> modifier can occur in any % expansion; .0 is equivalent to "unlimited", which is, of course, the default. --- httpd-2.0.49-orig/modules/loggers/mod_log_config.c Wed Mar 3 06:07:50 2004 +++ httpd-2.0.49/modules/loggers/mod_log_config.c Tue Jun 8 11:07:41 2004 @@ -271,6 +271,7 @@ char *arg; int condition_sense; int want_orig; + apr_size_t max_size; apr_array_header_t *conditions; } log_format_item; @@ -617,6 +618,7 @@ it->func = constant_item; it->conditions = NULL; + it->max_size = 0; s = *sa; while (*s && *s != '%') { @@ -683,6 +685,7 @@ ++s; it->condition_sense = 0; it->conditions = NULL; + it->max_size = 0; if (*s == '%') { it->arg = "%"; @@ -742,7 +745,13 @@ } *(int *) apr_array_push(it->conditions) = i; break; - + case '.': + i = 0; + while (apr_isdigit(*++s)) { + i = i * 10 + (*s) - '0'; + } + it->max_size = i; + break; default: handler = (ap_log_handler *)apr_hash_get(log_hash, s++, 1); if (!handler) { @@ -836,6 +845,7 @@ request_rec *orig; int i; apr_size_t len = 0; + apr_size_t itemlen; apr_array_header_t *format; char *envar; apr_status_t rv; @@ -881,7 +891,11 @@ } for (i = 0; i < format->nelts; ++i) { - len += strl[i] = strlen(strs[i]); + itemlen = strlen(strs[i]); + if (items[i].max_size != 0 && items[i].max_size < itemlen) { + itemlen = items[i].max_size; + } + len += strl[i] = itemlen; } if (!log_writer) { ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_EGENERAL, r, --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
