mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:20:15 +00:00
Merge pull request #14282 from mexon/mat/malformed-webfinger-400
Return 400 error code on malformed request.
This commit is contained in:
commit
946337645d
1 changed files with 4 additions and 1 deletions
|
@ -26,6 +26,7 @@ use Friendica\Core\System;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
use Friendica\Network\HTTPException\BadRequestException;
|
||||||
use Friendica\Network\HTTPException\NotFoundException;
|
use Friendica\Network\HTTPException\NotFoundException;
|
||||||
use Friendica\Protocol\ActivityNamespace;
|
use Friendica\Protocol\ActivityNamespace;
|
||||||
use Friendica\Protocol\Salmon;
|
use Friendica\Protocol\Salmon;
|
||||||
|
@ -68,13 +69,15 @@ class Xrd extends BaseModule
|
||||||
if (substr($uri, 0, 4) === 'http') {
|
if (substr($uri, 0, 4) === 'http') {
|
||||||
$name = ltrim(basename($uri), '~');
|
$name = ltrim(basename($uri), '~');
|
||||||
$host = parse_url($uri, PHP_URL_HOST);
|
$host = parse_url($uri, PHP_URL_HOST);
|
||||||
} else {
|
} else if (preg_match('/^[[:alpha:]][[:alnum:]+-.]+:/', $uri)) {
|
||||||
$local = str_replace('acct:', '', $uri);
|
$local = str_replace('acct:', '', $uri);
|
||||||
if (substr($local, 0, 2) == '//') {
|
if (substr($local, 0, 2) == '//') {
|
||||||
$local = substr($local, 2);
|
$local = substr($local, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
list($name, $host) = explode('@', $local);
|
list($name, $host) = explode('@', $local);
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($host) && $host !== DI::baseUrl()->getHost()) {
|
if (!empty($host) && $host !== DI::baseUrl()->getHost()) {
|
||||||
|
|
Loading…
Reference in a new issue