--- src/main/http_protocol.c.orig	Fri Jun 22 21:43:54 2001
+++ src/main/http_protocol.c	Thu Jan 24 15:30:57 2002
@@ -1067,6 +1067,20 @@
         while (*value == ' ' || *value == '\t')
             ++value;            /* Skip to start of value   */
 
+	if(strcasecmp(copy, "User-Agent") == 0) {
+	    char *p = value;
+	    while(*p) {
+		if(*p <= '\x1f' || '\x7f' <= *p) {
+		    r->status = HTTP_BAD_REQUEST;
+                    ap_table_setn(r->notes, "error-notes", ap_pstrcat(r->pool,
+                    "User-Agent header field contains illegal character(s),\n"
+		    "see RFC 2616 section 14.43 for detail.<P>\n", NULL));
+		    return;
+		}
+		p++;
+	    }
+	}
+
 	ap_table_addn(tmp_headers, copy, value);
     }
 
