Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 25565
Status: rejected
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: himself [...] tomott.de
Cc:
AdminCc:

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



Subject: UTF-8 handling broken in LWP::Protocol::http
LWP::Protocol::http does not handle UTF-8 data correctly since _new_socket has no binmode set and Content-Length is incorrectly calculated. Possible fix: ------------- - Introduce a binary option in LWP::UserAgent construction - check $self->{ua}{binary} in LWP::Protocol::http and choose correct handling for $socket and length/bytes (see below) Unfortunately all other Protocol implementation classes have to be adapted as well to be consistent ... Possible short-time workaround: ------------------------------- no warnings 'redefine'; my $old_code = \&LWP::Protocol::http::_new_socket; *LWP::Protocol::http::_new_socket = sub { my $sock = $old_code->(@_); binmode $sock, ':utf8'; return $sock; }; *LWP::Protocol::http::length = sub { use bytes; length shift; };
The content of the requests passed in should be bytes. Newer versions of LWP should be better at enforcing that.