Harald Joerg <[EMAIL PROTECTED]> writes:
> Gisle Aas writes:
>
> > Harald Joerg <[EMAIL PROTECTED]> writes:
> >
> >>As a fallback, HTTP::Response::parse could set the protocol to undef
> >>if it turns out to be a three-digit number, assigning this value to
> >>the code (after assigning to the message what was parsed as the code).
> > This is my preferred fix. Just make HTTP::Response::parse deal with
> > what as_string spits out. I would just make it look at the string
> > before spliting it. If it starts with /\d/ split in 2 instead of 3.
>
> Patch is attached.
Thanks. Applied.
Regards,
Gisle
> --- Response.pm.1.50 2004-12-02 21:36:42.437500000 +0100
> +++ Response.pm 2004-12-03 22:10:27.421875000 +0100
> @@ -35,5 +35,11 @@
>
> my $self = $class->SUPER::parse($str);
> - my($protocol, $code, $message) = split(' ', $status_line, 3);
> + my($protocol, $code, $message);
> + if ($status_line =~ /^\d{3} /) {
> + # Looks like a response created by HTTP::Response->new
> + ($code, $message) = split(' ', $status_line, 2);
> + } else {
> + ($protocol, $code, $message) = split(' ', $status_line, 3);
> + }
> $self->protocol($protocol) if $protocol;
> $self->code($code) if defined($code);