Content line

David Relson relson at osagesoftware.com
Fri Jul 18 16:18:51 CEST 2003


At 09:51 AM 7/18/03, Alejandro Dau wrote:
>Hello David,
>   I've noticed that if a mail has the following line in its headers:
>
>Content-Type: text
>
>bogofilter will ignore the tokens in its body.
>
>Please let me know if you need an example mail, or if I should send
>the report to somebody else.
>
>Regards, and thanks for bogofilter
>Alejandro Dau

Alejandro,

Thanks for reporting the problem.  Bogofilter tests for "text/html", 
"text/plain", and "text/".  According to rfc2045:

5.1.  Syntax of the Content-Type Header Field
    In the Augmented BNF notation of RFC 822, a Content-Type header field
    value is defined as follows:
      content := "Content-Type" ":" type "/" subtype
                 *(";" parameter)
                 ; Matching of media type and subtype
                 ; is ALWAYS case-insensitive.
etc,etc,etc.

So, "Content-Type: text" is not valid because the field should always 
contain "type '/' subtype".  However, bogofilter can easily be modified to 
accept a type without a subtype.  The attached patch makes that change.

I'm CC'ing the mailing list with this to see if people think bogofilter 
should accept this non-compliant construct.  Likely the answer is "Yes" 
because in several other ways bogofilter already follows common practice 
(as distinct from the standards).

David

P.S.  Can you forward an example mail to me as a gzipped attachment?
-------------- next part --------------
Index: mime.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/mime.c,v
retrieving revision 1.10
diff -u -r1.10 mime.c
--- mime.c	3 Jun 2003 11:58:01 -0000	1.10
+++ mime.c	18 Jul 2003 14:07:57 -0000
@@ -54,7 +54,7 @@
 {
   { MIME_TEXT_HTML, 	"text/html", 	 9, } ,
   { MIME_TEXT_PLAIN, 	"text/plain", 	10, } ,
-  { MIME_TEXT, 		"text/", 	 5, } ,
+  { MIME_TEXT, 		"text", 	 4, } ,
   { MIME_APPLICATION, 	"application/", 12, } ,
   { MIME_MESSAGE, 	"message/", 	 8, } ,
   { MIME_MULTIPART, 	"multipart/", 	10, } ,



More information about the Bogofilter mailing list