HTTP::Parser problem

[email protected] (Gerhard Rieger) Sun, 06 Feb 2011 23:29:18 +0100
Newsgroups perl.libwww
Message-ID <[email protected]>
Hi,

I experience a reproducable problem with the HTTP::Parser module. I run
the packaged Perl 5.10.1 on Ubuntu 10.4 Lucid. The problem appears with
the packaged version 3.64-1 of libhtml-parser-perl as well as with the
manually installed actual version 3.68.

Problem: Under some circumstances the parser breaks short continuous
text into two parts on a white space and invokes the text_handler
callback for each of these parts. Especially while parsing tables this
breaks the structure of the result.

It happens in long html lines and seems to have to do with 512 bytes
block boundaries.

Please find attached a short perl script, an html testcase and the
resulting output; after detaching run "./test.pl test.html"; the broken
output can easily be seen.

Please help!

Regards
Gerhard Rieger
test.pl (application/x-perl, 219 B)
#! /usr/bin/perl

use HTML::Parser ();

sub text_handler {
    print shift; print "\n";
}

my $p = HTML::Parser->new(api_version => 3);
$p->handler( text => \&text_handler, "dtext");
$p->parse_file($ARGV[0]) || die $!;
test.out (text/plain, 387 B)
Test

  

    
Test

    

      
xx y
xx y
xx y
xx y
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc d
ee f
gg h
aa b
cc
 d
ee f
gg h
aa b
cc d
ee f
gg h