aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-03-25 16:44:19 -0700
committerfriendica <info@friendica.com>2014-03-25 16:44:19 -0700
commitf924d38d8c2b79e4bfe8df438894ff1ad636e411 (patch)
tree25e80eb7d411bd1b67cfb6fc163d936f62765fe8
parent7375e305060df3818f01a96fbbd811921468ad89 (diff)
downloadvolse-hubzilla-f924d38d8c2b79e4bfe8df438894ff1ad636e411.tar.gz
volse-hubzilla-f924d38d8c2b79e4bfe8df438894ff1ad636e411.tar.bz2
volse-hubzilla-f924d38d8c2b79e4bfe8df438894ff1ad636e411.zip
webfinger enhancements: per RFC7033
-rw-r--r--mod/_well_known.php2
-rw-r--r--mod/wfinger.php22
2 files changed, 19 insertions, 5 deletions
diff --git a/mod/_well_known.php b/mod/_well_known.php
index 6e77336c3..c5a38078a 100644
--- a/mod/_well_known.php
+++ b/mod/_well_known.php
@@ -19,6 +19,8 @@ function _well_known_init(&$a){
require_once('mod/wfinger.php');
wfinger_init($a);
break;
+ default:
+ break;
}
}
diff --git a/mod/wfinger.php b/mod/wfinger.php
index fb75da193..bdec92b54 100644
--- a/mod/wfinger.php
+++ b/mod/wfinger.php
@@ -1,7 +1,7 @@
<?php
function wfinger_init(&$a) {
-
+
$result = array();
$scheme = '';
@@ -20,9 +20,6 @@ function wfinger_init(&$a) {
$resource = $_REQUEST['resource'];
- header('Access-Control-Allow-Origin: *');
-
- header('Content-type: application/jrd+json');
$r = null;
@@ -30,7 +27,13 @@ function wfinger_init(&$a) {
if(strpos($resource,'acct:') === 0) {
$channel = str_replace('acct:','',$resource);
- $channel = substr($channel,0,strpos($channel,'@'));
+ if(strpos($channel,'@') !== false) {
+ $host = substr($channel,strpos($channel,'@')+1);
+ if(strcasecmp($host,get_app()->get_hostname())) {
+ goaway('https://' . $host . '/.well-known/webfinger?resource=' . $resource);
+ }
+ $channel = substr($channel,0,strpos($channel,'@'));
+ }
}
if(strpos($resource,'http') === 0) {
$channel = str_replace('~','',basename($resource));
@@ -43,6 +46,13 @@ function wfinger_init(&$a) {
}
+
+ header('Access-Control-Allow-Origin: *');
+
+ header('Content-type: application/jrd+json');
+
+
+
if($resource && $r) {
$result['subject'] = $resource;
@@ -55,6 +65,8 @@ function wfinger_init(&$a) {
$result['aliases'] = array();
+ $result['properties'] = array('http://webfinger.example/ns/name' => $r[0]['channel_name']);
+
foreach($aliases as $alias)
if($alias != $resource)
$result['aliases'][] = $alias;