--- ../../SOURCES/httpd-2.2.3/modules/loggers/mod_log_config.c 2006-07-11 20:38:44.000000000 -0700 +++ modules/loggers/mod_log_config.c 2006-09-22 10:43:40.000000000 -0700 @@ -272,6 +272,7 @@ char *arg; int condition_sense; int want_orig; + int want_empty; apr_array_header_t *conditions; } log_format_item; @@ -283,7 +284,7 @@ static char *pfmt(apr_pool_t *p, int i) { if (i <= 0) { - return "-"; + return NULL; } else { return format_integer(p, i); @@ -322,7 +323,7 @@ char *rvalue = r->user; if (rvalue == NULL) { - rvalue = "-"; + return NULL; } else if (strlen(rvalue) == 0) { rvalue = "\"\""; @@ -381,7 +382,7 @@ static const char *clf_log_bytes_sent(request_rec *r, char *a) { if (!r->sent_bodyct || !r->bytes_sent) { - return "-"; + return NULL; } else { return apr_off_t_toa(r->pool, r->bytes_sent); @@ -774,6 +775,8 @@ it->want_orig = -1; it->arg = ""; /* For safety's sake... */ + it->want_empty = 0; + while (*s) { int i; @@ -802,6 +805,11 @@ it->arg = ap_getword(p, &s, '}'); break; + case '^': + ++s; + it->want_empty = 1; + break; + case '0': case '1': case '2': @@ -887,14 +895,18 @@ if ((item->condition_sense && in_list) || (!item->condition_sense && !in_list)) { - return "-"; + return item->want_empty ? "" : "-"; } } /* We do. Do it... */ cp = (*item->func) (item->want_orig ? orig : r, item->arg); - return cp ? cp : "-"; + + if (cp == NULL) + return item->want_empty ? "" : "-"; + + return cp; } static void flush_log(buffered_log *buf) @@ -1375,7 +1387,7 @@ pl = ap_open_piped_log(p, name + 1); if (pl == NULL) { - return NULL;; + return NULL; } return ap_piped_log_write_fd(pl); }