]> git.mxchange.org Git - friendica.git/blobdiff - mod/xrd.php
Avoid beeing flooded by invalid requests
[friendica.git] / mod / xrd.php
index 61505f29966e99d2ea4f66f27d2cb091a8bf16cc..921d48fe93708cddf1c66280207cadc5baf6734a 100644 (file)
@@ -13,7 +13,7 @@ function xrd_init(App $a)
 {
        if ($a->argv[0] == 'xrd') {
                if (empty($_GET['uri'])) {
-                       killme();
+                       System::httpExit(404);
                }
 
                $uri = urldecode(notags(trim($_GET['uri'])));
@@ -24,7 +24,7 @@ function xrd_init(App $a)
                }
        } else {
                if (empty($_GET['resource'])) {
-                       killme();
+                       System::httpExit(404);
                }
 
                $uri = urldecode(notags(trim($_GET['resource'])));
@@ -48,7 +48,7 @@ function xrd_init(App $a)
 
        $user = DBA::selectFirst('user', [], ['nickname' => $name]);
        if (!DBA::isResult($user)) {
-               killme();
+               System::httpExit(404);
        }
 
        $profile_url = System::baseUrl().'/profile/'.$user['nickname'];
@@ -80,6 +80,7 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
                        ['rel' => NAMESPACE_DFRN, 'href' => $profile_url],
                        ['rel' => NAMESPACE_FEED, 'type' => 'application/atom+xml', 'href' => System::baseUrl().'/dfrn_poll/'.$r['nickname']],
                        ['rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => $profile_url],
+                       ['rel' => 'self', 'type' => 'application/activity+json', 'href' => $profile_url],
                        ['rel' => 'http://microformats.org/profile/hcard', 'type' => 'text/html', 'href' => System::baseUrl().'/hcard/'.$r['nickname']],
                        ['rel' => NAMESPACE_POCO, 'href' => System::baseUrl().'/poco/'.$r['nickname']],
                        ['rel' => 'http://webfinger.net/rel/avatar', 'type' => 'image/jpeg', 'href' => System::baseUrl().'/photo/profile/'.$r['uid'].'.jpg'],
@@ -92,6 +93,7 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
                        ['rel' => 'http://purl.org/openwebauth/v1', 'type' => 'application/x-dfrn+json', 'href' => System::baseUrl().'/owa']
                ]
        ];
+
        echo json_encode($json);
        killme();
 }