This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to annotated tag v1.16
in repository libnet-openid-common-perl.

commit a09b91e75637a2dc72a3fdccb0bb9fee14952d04
Author: Vernon Lyon <vernonl...@hotmail.com>
Date:   Wed Aug 22 16:35:56 2012 +0100

    use HTTP::Response to decode content (closes #78218)
---
 lib/Net/OpenID/URIFetch.pm | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/lib/Net/OpenID/URIFetch.pm b/lib/Net/OpenID/URIFetch.pm
index 909c30a..62f4e08 100644
--- a/lib/Net/OpenID/URIFetch.pm
+++ b/lib/Net/OpenID/URIFetch.pm
@@ -24,12 +24,7 @@ use HTTP::Request;
 use HTTP::Status;
 use strict;
 use warnings;
-use Carp;
-
-our $HAS_ZLIB;
-BEGIN {
-    $HAS_ZLIB = eval "use Compress::Zlib (); 1;";
-}
+use Carp();
 
 use constant URI_OK                => 200;
 use constant URI_MOVED_PERMANENTLY => 301;
@@ -88,9 +83,7 @@ sub fetch {
     }
 
     my $req = HTTP::Request->new(GET => $uri);
-    if ($HAS_ZLIB) {
-        $req->header('Accept-Encoding', 'gzip');
-    }
+    $req->header('Accept-Encoding', scalar HTTP::Message::decodable());
     if ($ref) {
         if (my $etag = ($ref->{Headers}->{etag})) {
             $req->header('If-None-Match', $etag);
@@ -112,13 +105,12 @@ sub fetch {
         return $cached_response->();
     }
     else {
-        my $content = $res->content;
         my $final_uri = $res->request->uri->as_string();
         my $final_cache_key = "URIFetch:${prefix}:${final_uri}";
 
-        if ($res->content_encoding && $res->content_encoding eq 'gzip') {
-            $content = Compress::Zlib::memGunzip($content);
-        }
+        my $content = $res->decoded_content             # Decode 
content-encoding and charset
+            || $res->decoded_content(charset => 'none') # Decode 
content-encoding
+            || $res->content;                           # Undecoded content
 
         if ($content_hook) {
             $content_hook->(\$content);

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libnet-openid-common-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to