Skip Menu |

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

Report information
The Basics
Id: 71074
Status: resolved
Priority: 0/
Queue: HTTP-Message

Owner: Nobody in particular
Requestors: user42 [...]

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

Subject: decoded_content() of "bzip2"
Date: Tue, 20 Sep 2011 08:13:52 +1000
To: bug-HTTP-Message [...]
From: Kevin Ryde <user42 [...]>
Download (untitled) / with headers
text/plain 1.1k
The "lighttpd/1.4.19" server at seems to send back Content-Encoding: bzip2 rather than "x-bzip2", even when Accept-Encoding says x-bzip2. HTTP::Message 6.02 doesn't seem to be able to decode that. Sample program below fetches decodable: gzip, x-gzip, deflate, x-bzip2 GET Accept-Encoding: gzip, x-gzip, deflate, x-bzip2 (no content) HTTP/1.1 200 OK Connection: close Date: Mon, 19 Sep 2011 22:04:00 GMT Accept-Ranges: bytes ETag: "2982766414" Server: lighttpd/1.4.19 Vary: Accept-Encoding Content-Encoding: bzip2 Content-Length: 1024 Content-Type: application/xml Last-Modified: Mon, 19 Sep 2011 06:28:28 GMT Client-Date: Mon, 19 Sep 2011 22:04:11 GMT Client-Peer: Client-Response-Num: 1 BZ... decode() false Don't know how to decode Content-Encoding 'bzip2' at /usr/share/perl5/HTTP/ line 354. at line 19 where I hoped that Content-Encoding "bzip2" might be as good as "x-bzip2", even if perhaps the server is doing the wrong thing by sending back an encoding name not among those the request said were acceptable.
text/x-perl 486b
use LWP::UserAgent; my $ua = LWP::UserAgent->new; use HTTP::Request; my $req = HTTP::Request->new (GET => ''); my $decodable = HTTP::Message::decodable(); print "decodable: $decodable\n"; $req->header ('Accept-Encoding' => $decodable); print $req->dump; print "\n"; my $resp = $ua->request($req); print $resp->dump; print "\n"; $resp->decode() or print "decode() false\n"; $resp->decoded_content(charset => 'none', raise_error => 1);
Download (untitled) / with headers
text/plain 737b
commit 84c1919a9ded22623c023de82127f2b671d9c6f7 Author: Gisle Aas <> Date: Thu Feb 16 22:45:51 2012 +0100 Recognize Content-Encoding: bzip2 [RT#71074] diff --git a/lib/HTTP/ b/lib/HTTP/ index b7aa09a..b18b778 100644 --- a/lib/HTTP/ +++ b/lib/HTTP/ @@ -307,7 +307,7 @@ sub decoded_content $content_ref = \$output; $content_ref_iscopy++; } - elsif ($ce eq "x-bzip2") { + elsif ($ce eq "x-bzip2" or $ce eq "bzip2") { require IO::Uncompress::Bunzip2; my $output; IO::Uncompress::Bunzip2::bunzip2($content_ref, \$output, Transparent => 0)

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to