aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-06-15 11:53:00 +0200
committerHarald Eilertsen <haraldei@anduin.net>2024-10-06 11:47:45 +0200
commitbccac55cf99fd4cd0d21bc1ad5e0ef16a762d74f (patch)
tree81141b5f8b3785a19e94e1b0a1b6b72c2735935e /Zotlabs
parent2693e9e99097c4bbcf8c9103a5876bc0585ff84c (diff)
downloadvolse-hubzilla-bccac55cf99fd4cd0d21bc1ad5e0ef16a762d74f.tar.gz
volse-hubzilla-bccac55cf99fd4cd0d21bc1ad5e0ef16a762d74f.tar.bz2
volse-hubzilla-bccac55cf99fd4cd0d21bc1ad5e0ef16a762d74f.zip
tests: Add some tests for the Zotlabs\Magic module.
Only tests the delegate functionality at the moment. This patch also includes some minor fixes to the Magic module, triggered by the tests with empty destination URL's.
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Magic.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/Zotlabs/Module/Magic.php b/Zotlabs/Module/Magic.php
index 8259f7d39..deda4255d 100644
--- a/Zotlabs/Module/Magic.php
+++ b/Zotlabs/Module/Magic.php
@@ -40,7 +40,11 @@ class Magic extends Controller {
goaway($dest);
}
- $basepath = $parsed['scheme'] . '://' . $parsed['host'] . (isset($parsed['port']) ? ':' . $parsed['port'] : '');
+ $basepath = unparse_url(array_filter(
+ $parsed,
+ fn (string $key) => in_array($key, ['scheme', 'host', 'port']),
+ ARRAY_FILTER_USE_KEY
+ ));
$owapath = SConfig::get($basepath,'system','openwebauth', $basepath . '/owa');
// This is ready-made for a plugin that provides a blacklist or "ask me" before blindly authenticating.
@@ -106,7 +110,7 @@ class Magic extends Controller {
$headers['Content-Type'] = 'application/x-zot+json' ;
$headers['X-Open-Web-Auth'] = random_string();
$headers['Host'] = $parsed['host'];
- $headers['(request-target)'] = 'get ' . '/owa';
+ $headers['(request-target)'] = 'get /owa';
$headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], channel_url($channel),true,'sha512');
$redirects = 0;