Skip to content

bug in HTTP::Message::decoded_content() [rt.cpan.org #86272] #73

@oalders

Description

@oalders

Migrated from rt.cpan.org#86272 (status was 'open')

Requestors:

Attachments:

From p.gackiewicz@intertele.pl on 2013-06-20 08:17:48:

Hi.

I think there is a bug in decoded_content() function in this package.
In version 6.06, it evals such piece of code:

   if ($self->content_is_text || (my $is_xml = $self->content_is_xml)) {
       my $charset = lc(
           $opt{charset} ||
           $self->content_type_charset ||
           $opt{default_charset} ||
           $self->content_charset ||      # <=============
           "ISO-8859-1"
       );

...


but content_charset() calls decoded_content() again, creating circular
dependency. Evaled code silently dies then. If it is not logical error,
this code should be probably rewritten.

I found it trying to install CPAN XML::Twig code. It did not pass several
tests using LWP::Simple, loading simple HTML via file: url.

Simple patch attached, removing this call.

Regards,

-- 
Piotr Gackiewicz
Intertele S.A. - operator systemów ITL.PL i DOMENY.ITL.PL
al. T. Rejtana 10, 35-310 Rzeszów
TEL: +48 17 8507580, FAX: +48 17 8520275

http://www.itl.pl       - niezawodne serwery wirtualne
http://domeny.itl.pl    - tanie domeny internetowe
http://www.intertele.pl

From gaas@cpan.org on 2013-06-21 21:04:34:

I can't see anything wrong with the current code. The inner call to
decoded_content shouid never recurse further as it's called with charset =>
none.

Can you provide a small test case that demonstrates infinite recursion? I
wasn't able to reproduce any bad behaviour on my own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions