]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
meta: Ensure that the url specified by xrds-location is absolute.
authorJoey Hess <joey@kitenet.net>
Mon, 20 Sep 2010 00:15:34 +0000 (20:15 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 20 Sep 2010 00:15:34 +0000 (20:15 -0400)
With a relative xrds-location, the openid perl client module will fail.
I haven't checked the specs to see if it needs to be absolute, but all
examples I've seen are absolute, so it seems a very good idea.

IkiWiki/Plugin/meta.pm
debian/changelog

index ae593555e72010dfea12c248631d7e883d9df6c8..5cfa7283350885181b9e8e194e87a4448c235c10 100644 (file)
@@ -198,8 +198,12 @@ sub preprocess (@) {
                                '" rel="openid2.local_id" />' if $delegate ne 1;
                }
                if (exists $params{"xrds-location"} && safeurl($params{"xrds-location"})) {
+                       # force url absolute
+                       eval q{use URI};
+                       error($@) if $@;
+                       my $url=URI->new_abs($params{"xrds-location"}, $config{url});
                        push @{$metaheaders{$page}}, '<meta http-equiv="X-XRDS-Location" '.
-                               'content="'.encode_entities($params{"xrds-location"}).'" />';
+                               'content="'.encode_entities($url).'" />';
                }
        }
        elsif ($key eq 'redir') {
index 8286b7887591018a3ddfc2794e61001fe5bcb648..24115c1772aa63bad6fed478333aa936f4a65d47 100644 (file)
@@ -1,3 +1,9 @@
+ikiwiki (3.20100916) UNRELEASED; urgency=low
+
+  * meta: Ensure that the url specified by xrds-location is absolute.
+
+ -- Joey Hess <joeyh@debian.org>  Sun, 19 Sep 2010 20:13:06 -0400
+
 ikiwiki (3.20100915) unstable; urgency=low
 
   * needsbuild hook interface changed; the hooks should now return