Date: March 23, 2005 3:23:39 PM MST
Subject: Header detection bug in HTTP::Message::parse()
Hi!
I've stumbled across a bug in multi-part messages in HTTP::Message.� If the body of the message contains something that looks like a header, it accidentally gets detected as a header. � However, a blank line after a header should signal the end of headers, and below it, the start of content as per the spec.� It just looks like your regex needs some tweeking, or maybe do something like this -- though I'm no regex genius:
sub parse
{
� � my($class, $str) = @_;
�� �my ($headPart,$contentPart) = split(/\r?\n\r?\n/,$str,2);
� � my @hdr;
� � while ($headPart =~ s/^([^ \t:]+)[ \t]*: ?(.*)\n?//) {
� � � � push(@hdr, $1, $2);
� � }
� � new($class, [EMAIL PROTECTED], $contentPart);
}
I've included a sample program to reproduce the problem so you can see better what I'm trying to say.� If you look at the Dumper() output for the part "3fc90c2f106c4dc7e7742d6bb12b68f7" you'll see that it got detected
incorrectly.
Let me know if there is anything i can do to help.