Skip Menu |

This queue is for tickets about the Mail-Box CPAN distribution.

Report information
The Basics
Id: 90035
Status: resolved
Priority: 0/
Queue: Mail-Box

People
Owner: Nobody in particular
Requestors: _ [...] maxb.eu
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.105
Fixed in: 2.110



Subject: Tolerate extra whitespace in header parameters
There seems to be a fair amount of email out there with MIME Content-Type headers containing extra whitespace around the =-sign of parameters: Content-Type: text/plain; charset = "utf-8" It's probably most/all spam, but it would be nice if Mail-Box could tolerate it without logging warnings like: WARNING: Illegal character in parameter name 'charset '.
Subject: Re: [rt.cpan.org #90035] Tolerate extra whitespace in header parameters
Date: Mon, 4 Nov 2013 13:34:12 +0100
To: "https://launchpad.net/~maxb via RT" <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* https://launchpad.net/~maxb via RT (bug-Mail-Box@rt.cpan.org) [131104 12:09]: Show quoted text
> Mon Nov 04 07:09:05 2013: Request 90035 was acted upon. > Transaction: Ticket created by https://launchpad.net/~maxb > Queue: Mail-Box > Subject: Tolerate extra whitespace in header parameters > Broken in: 2.105 > > There seems to be a fair amount of email out there with MIME > Content-Type headers containing extra whitespace around the =-sign > of parameters: > > Content-Type: text/plain; charset = "utf-8"
I do not know whether it is allowed according to the RFCs, but it seems sensible. This should work: in lib/Mail/Message/Field/Attribute.pm: - my $name = ($attr =~ m/^(.*?)(?:\*\d+)?\*?\=/ ? $1 : $attr); + my $name = ($attr =~ m/^(.*?)(?:\*\d+)?\*?\s*\=\s*/ ? $1 : $attr); $self->log(WARNING => "Illegal character in parameter name '$name'.") if $name !~ m/^[!#-'*+\-.0-9A-Z^-~]+$/; Does it help? -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net