Skip Menu |

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

Report information
The Basics
Id: 53424
Status: resolved
Priority: 0/
Queue: HTTP-Body

People
Owner: Nobody in particular
Requestors: felix.ostmann [...] thewar.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 1.05



Subject: failed test in t/05urlencoded.t
t/05urlencoded.t ... 1/31
Show quoted text
#   Failed test '001 UrlEncoded param'
#   at t/05urlencoded.t line 32.
#     Structures begin differing at:
#          $got->{text2} = 'åäöåäö'
#     $expected->{text2} = '������'

Show quoted text
#   Failed test '003 UrlEncoded param'
#   at t/05urlencoded.t line 32.
#     Structures begin differing at:
#          $got->{text2} = 'åäöåäö'
#     $expected->{text2} = '������'
# Looks like you failed 2 tests of 31.
t/05urlencoded.t ... Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/31 subtests



Perhaps YAML changed the encoding while loading?

On Wed Jan 06 05:35:32 2010, Sadrak wrote:
Show quoted text
> t/05urlencoded.t ... 1/31
> # Failed test '001 UrlEncoded param'
> # at t/05urlencoded.t line 32.
> # Structures begin differing at:
> # $got->{text2} = 'åäöåäö'
> # $expected->{text2} = '������'
>
> # Failed test '003 UrlEncoded param'
> # at t/05urlencoded.t line 32.
> # Structures begin differing at:
> # $got->{text2} = 'åäöåäö'
> # $expected->{text2} = '������'
> # Looks like you failed 2 tests of 31.
> t/05urlencoded.t ... Dubious, test returned 2 (wstat 512, 0x200)
> Failed 2/31 subtests
>
>
>
> Perhaps YAML changed the encoding while loading?

YAML recently changed, here's a discussion:

https://rt.cpan.org/Ticket/Display.html?id=53452

I think LoadFile expects utf8 or similar.  i'm not expert on UTF8 so I don't know, but this seems like a false positive failure to me.  Unfortunately doesn't seem like the YAML people are considering this a bug on their side.  Hopefully we can just alter this test.  I'd be happy to help, just point me to a repository.

jjnapiork@cpan.org

I do not want to judge on the YAML release but introducing a policy towards Unicode encodings seems like a good thing on their side. Unfortunately it leaves YAML::LoadFile poisoned. On the other hand, HTTP::Body::UrlEncoded doesn't have a policy towards encoding but probably should have. The fix I would suggest for HTTP::Body is to refuse using YAML::LoadFile and use the unpoisoned YAML::Load instead. So my immediate fix would be this patch: --- t/05urlencoded.t~ 2010-01-09 11:16:34.000000000 +0100 +++ t/05urlencoded.t 2010-01-09 11:20:24.000000000 +0100 @@ -14,11 +14,15 @@ my $path = catdir( getcwd(), 't', 'data', 'urlencoded' ); +sub slurp ($) { + return scalar do { open my $fh, shift or die; local $/; <$fh> }; +} + for ( my $i = 1; $i <= 6; $i++ ) { my $test = sprintf( "%.3d", $i ); - my $headers = YAML::LoadFile( catfile( $path, "$test-headers.yml" ) ); - my $results = YAML::LoadFile( catfile( $path, "$test-results.yml" ) ); + my $headers = YAML::Load( slurp catfile( $path, "$test-headers.yml" ) ); + my $results = YAML::Load( slurp catfile( $path, "$test-results.yml" ) ); my $content = IO::File->new( catfile( $path, "$test-content.dat" ) ); my $body = HTTP::Body->new( $headers->{'Content-Type'}, $headers->{'Content-Length'} ); All tests pass again with this. HTH,
Patch now available at ftp://cpan.cpantesters.org/CPAN/authors/id/A/AN/ANDK/patches/HTTP-Body-1.05-ANDK-01.patch.gz distroprefs file at http://github.com/andk/cpanpm/blob/8aabb1c8f60622f72de1d9f0ebea780d487c9c27/distroprefs/AGRUNDMA.HTTP-Body.yml Over,
Hi: I have no idea if this is actually fixed, however, it seems that the module now uses PAML (it includes this, and it's not released on CPAN) to serialize data structures (using something like Data::Dumper) into .pml files, then load them using eval... I've removed the patch in the Debian version of this package, but I'm not sure whether this really fixes the issue we've all been having. Cheers, Jonathan
Vid Sun, 10 Jan 2010 kl. 11.17.07, skrev JAWNSY: Show quoted text
> Hi: > > I have no idea if this is actually fixed, however, it seems that the > module now uses PAML (it includes this, and it's not released on CPAN) > to serialize data structures (using something like Data::Dumper) into > .pml files, then load them using eval... > > I've removed the patch in the Debian version of this package, but I'm > not sure whether this really fixes the issue we've all been having.
Issue should be resolved. The issue was that earlier versions of YAML.pm was not unicode aware and simple treated all data as octets, this fitted our test fixtures. HTTP::Body does not care about unicode, only octets. When YAML.pm upgraded our latin-1 octets to unicode our tests broke, thats why we decided to drop YAML.pm for our test fixtures and wrote PAML.pm. Thanks for your support -- chansen