$NetBSD: patch-aj,v 1.6 2002/10/13 16:43:21 taca Exp $

--- src/access_log.c.orig	Sun Jun 16 20:25:40 2002
+++ src/access_log.c
@@ -120,6 +120,8 @@ log_quote(const char *header)
 {
     int c;
     int i;
+    int log_all, check_name, log_this;
+    const struct _wordlist *wl;
     char *buf;
     char *buf_cursor;
     if (header == NULL) {
@@ -129,13 +131,41 @@ log_quote(const char *header)
     }
     buf = xcalloc(1, (strlen(header) * 3) + 1);
     buf_cursor = buf;
+
+    /* if empty or first keyword is "all", log all mime headers */
+    log_all = (!Config.log_mime_hdrs_list
+		|| strcasecmp(Config.log_mime_hdrs_list->key, "all") == 0);
+
     /*
      * We escape: \x00-\x1F"#%;<>?{}|\\\\^~`\[\]\x7F-\xFF 
      * which is the default escape list for the CPAN Perl5 URI module
      * modulo the inclusion of space (x40) to make the raw logs a bit
      * more readable.
      */
-    while ((c = *(const unsigned char *) header++) != '\0') {
+    check_name = 1;
+    log_this = 1;
+    for(; (c = *(const unsigned char *) header) != '\0'; header++) {
+	if (!log_all && check_name) {
+		/* loop over configured header names and only continue
+		 * if the current header is on the list */
+		wl = Config.log_mime_hdrs_list;
+		log_this = 0;
+		for(; wl; wl = wl->next) {
+			if (strncasecmp(wl->key, header, strlen(wl->key)) == 0){
+				log_this = 1;
+				break;
+			}
+		}
+		check_name = 0;
+	}
+	if (!log_this) {
+		if (c == '\n') {
+			/* check header name in next iteration */
+			check_name = 1;
+		}
+		continue;
+	}
+ 
 #if !OLD_LOG_MIME
 	if (c == '\r') {
 	    *buf_cursor++ = '\\';
@@ -143,6 +173,7 @@ log_quote(const char *header)
 	} else if (c == '\n') {
 	    *buf_cursor++ = '\\';
 	    *buf_cursor++ = 'n';
+	    check_name = 1;
 	} else
 #endif
 	    if (c <= 0x1F
