[libnet-openid-common-perl] 07/09: make YADIS discovery check for meta/http-equiv tags

gregor herrmann gregoa at debian.org
Sun Feb 7 21:50:29 UTC 2016


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

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

commit a2288488a56bdb39488dbf23c6bb4fd4037946fa
Author: Roger Crew <crew at cs.stanford.edu>
Date:   Tue Oct 25 11:28:11 2011 -0700

    make YADIS discovery check for meta/http-equiv tags
    
    do it as a last-ditch effort and it *is* in the spec, so
---
 lib/Net/OpenID/Yadis.pm | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/Net/OpenID/Yadis.pm b/lib/Net/OpenID/Yadis.pm
index 6f544ba..08c2b58 100644
--- a/lib/Net/OpenID/Yadis.pm
+++ b/lib/Net/OpenID/Yadis.pm
@@ -148,14 +148,24 @@ sub discover {
 
     $self->identity_url($final_url) if ($count < YR_XRDS);
 
-    my $doc_url;
-    if (($doc_url = $headers{'x-yadis-location'} || $headers{'x-xrds-location'}) && ($count < YR_XRDS)) {
+    if ($count < YR_XRDS and
+        my $doc_url = $headers{'x-yadis-location'} || $headers{'x-xrds-location'}
+       ) {
         return $self->discover($doc_url, YR_XRDS);
     }
-    elsif ( (split /;\s*/, $headers{'content-type'})[0] eq 'application/xrds+xml') {
+    elsif ( (my $ctype = (split /;\s*/, $headers{'content-type'})[0]) eq 'application/xrds+xml') {
         $self->xrd_url($final_url);
         return $self->parse_xrd($xrd);
     }
+    elsif ( $ctype eq 'text/html' and
+            my ($meta) = grep {
+                my $heqv = lc($_->{'http-equiv'}||'');
+                $heqv eq 'x-yadis-location' || $heqv eq 'x-xrds-location'
+            }
+            @{OpenID::util::html_extract_linkmetas($xrd)->{meta}||[]}
+          ) {
+        return $self->discover($meta->{content}, YR_XRDS);
+    }
     else {
         return $self->_fail($count == YR_GET ? "no_yadis_document" : "too_many_hops");
     }

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



More information about the Pkg-perl-cvs-commits mailing list