Bug 19 - NoMailAudit header names case sensitive
Summary: NoMailAudit header names case sensitive
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: 2.0
Hardware: All NetBSD
: P3 normal
Target Milestone: ---
Assignee: Craig Hughes
URL:
Whiteboard:
Keywords:
: 35 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-01-31 18:37 UTC by BIll Sommerfeld
Modified: 2002-02-15 02:18 UTC (History)
1 user (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description BIll Sommerfeld 2002-01-31 18:37:52 UTC
had a false negative with:

Content-type: text/html

due to CTYPE_JUST_HTML not triggering.

turns out that check_for_content_type_just_html() looks for Content-Type:
(upper-case T).  

I worked around this by changing the end of the function to:

  if ($ctype =~ /^text\/html\b/) { return 1; }

  $ctype = $self->get ('Content-type');

  if ($ctype =~ /^text\/html\b/) { return 1; }

Perhaps self->get() should do case-insensitive matches on the 
header field name..
Comment 1 Craig Hughes 2002-02-04 00:53:47 UTC
Aiiiiyeee.  The way get() is implemented will make this hard, but you're right,
the header matching needs to be case-insensitive.  We ran into this same issue
elsewhere when the subject header appeared as SUBJECT: instead of the usual Subject:

I'll leave it at P3 since it's not critical but will hopefully get around to it
at some point.
Comment 2 Craig Hughes 2002-02-06 18:03:51 UTC
Ok, I resolved this and have checked in a version to CVS which should solve all
header-capitalization problems.  I modified two functions in NoMailAudit to
accomplish this:

1. get_header() now returns an array of all the headers which case-insentively
match, so get_header("content-type") will give you Content-Type, Content-type,
CoNtEnT-TyPe, etc.
2. replace_header() now replaces the first header which case-insensitively
matches the arg, to replace_header("subject",$text) will replace Subject: or
subject: or SUBJECT:, etc, whichever occurs first in the message.

I imagine if there are bugs in this code, they'll show up fast, cos it gets hit
a lot.
Comment 3 Craig Hughes 2002-02-15 11:18:27 UTC
*** Bug 35 has been marked as a duplicate of this bug. ***