Re: Fix for LWP::Protocol::http.pm
Gisle Aas (aas@bergen.sn.no)
28 Jan 1997 09:34:07 +0100
"Paul J. Schinder" <schinder@pjstoaster.pg.md.us> writes:
> I was trying out my MacPerl port of libwww-perl-5.06 tonight and one of my
> scripts broke because the headers weren't being parsed correctly from some
> servers, although it continued to work for others. I tracked the problem
> down to line 126 of LWP::Protocol::http.pm. This line:
>
> if ($res =~ s/^(HTTP\/\d+\.\d+)\s+(\d+)\s+(.*)\012//) {
>
> should probably read
>
> if ($res =~ s/^(HTTP\/\d+\.\d+)\s+(\d+)\s+(.*)\015?\012//) {
>
> The reason the original doesn't work in MacPerl is that . won't match \015,
> the Mac newline character. I've run one (and only one) test to make sure
> this still works on my Sun workstation (Perl 5.003), and it seems that this
> should make line 129 unnecessary, although as I've said I haven't done a
> great deal of testing.
Another fix might be to replace (.*) with ([^\012]*). I like that better.
Regards,
Gisle