Bug#745823: libwww-perl: an https request with iso-8859-1 headers, chunked transfer and data with utf8 bit on is corrupted.

John Hughes john at calva.com
Sat Apr 26 16:49:10 UTC 2014


On 26/04/14 18:12, John Hughes wrote:
>
>
> We could just unconditionaly call "utf8::downgrade ($data);"

Interestingly there is code in HTTP::Message that does that, but we're 
going from LWP::Protocol::http::request to 
LWP::Protocol::https::Socket->syswrite.

This fixes it for me.

--- /usr/share/perl5/LWP/Protocol/http.pm	2010-01-22 22:44:52.000000000 +0100
+++ /usr/local/share/perl/5.10.1/LWP/Protocol/http.pm	2014-04-26 18:45:56.000000000 +0200
@@ -240,6 +240,7 @@
  	if (ref($content_ref) eq 'CODE') {
  	    my $buf = &$content_ref();
  	    $buf = "" unless defined($buf);
+	    utf8::downgrade ($buf);
  	    $buf = sprintf "%x%s%s%s", length($buf), $CRLF, $buf, $CRLF
  		if $chunked;
  	    substr($buf, 0, 0) = $req_buf if $req_buf



More information about the pkg-perl-maintainers mailing list