Re: parsing bug in HTTP::Message::parse()
am 15.06.2005 01:13:49 von bhirtAny news on this? It's a pretty major bug.
--brian
On May 30, 2005, at 5:30 PM, Brian Hirt wrote:
> I'm following up on a bug I've run into with HTTP::Message. I
> think my original message might have been lost or sent to the wrong
> address (i sent it to the contact listed in the module, not the list).
>
> Begin forwarded message:
>
>> From: Brian Hirt
>> Date: March 23, 2005 3:23:39 PM MST
>> To: gisle@ActiveState.com
>> Cc: Brian Hirt
>> 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, \@hdr, $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.
>>
--------------------------------------------
MobyGames
http://www.mobygames.com
The world's largest and most comprehensive
gaming database project