Skip Menu |

This queue is for tickets about the HTTP-Parser CPAN distribution.

Report information
The Basics
Id: 34019
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: HTTP-Parser

People
Owner: david [...] edeca.net
Requestors: david [...] edeca.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.04
Fixed in: (no value)



Subject: Response message is not correctly parsed
Only the first word of any response text is parsed due to the usage of split with a space as the separator. This results in messages such as "Object" or "File". The attached patch uses a regex instead to pull out the whole response message, such as "Object moved" or "File not found".
Subject: 20080312-http-parser-response-text.patch
--- HTTP-Parser-0.04/Parser.pm 2007-11-10 22:39:21.000000000 +0000 +++ HTTP-Parser-0.04/Parser.pm 2008-03-12 12:46:14.000000000 +0000 @@ -231,7 +231,9 @@ if ($request =~ /^HTTP\/(\d+)\.(\d+)/i) { die 'HTTP responses not allowed' unless $self->{response}; ($major,$minor) = ($1,$2); - my (undef, $state, $msg) = split / /,$request; + $request =~ /^HTTP\/\d+\.\d+ (\d+) (.+)$/; + my $state = $1; + my $msg = $2; $obj = $self->{obj} = HTTP::Response->new($state, $msg); # perhaps a request?