diff options
author | zotlabs <mike@macgirvin.com> | 2018-11-06 20:44:40 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-11-06 20:44:40 -0800 |
commit | bb8b3b92913832750a393533f491725b4330a8e1 (patch) | |
tree | 3fbcd1466f061fc85129e3caa165b9df999a59a1 /Zotlabs/Lib/Zotfinger.php | |
parent | e7f1d350c92bb2be87adefd33ab877ef6e121af2 (diff) | |
download | volse-hubzilla-bb8b3b92913832750a393533f491725b4330a8e1.tar.gz volse-hubzilla-bb8b3b92913832750a393533f491725b4330a8e1.tar.bz2 volse-hubzilla-bb8b3b92913832750a393533f491725b4330a8e1.zip |
this is brutal
Diffstat (limited to 'Zotlabs/Lib/Zotfinger.php')
-rw-r--r-- | Zotlabs/Lib/Zotfinger.php | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/Zotlabs/Lib/Zotfinger.php b/Zotlabs/Lib/Zotfinger.php index 537e440d4..d094fdc8d 100644 --- a/Zotlabs/Lib/Zotfinger.php +++ b/Zotlabs/Lib/Zotfinger.php @@ -2,7 +2,7 @@ namespace Zotlabs\Lib; -use Zotlabs\Web\HTTPSig; +use Zotlabs\Zot6\HTTPSig; class Zotfinger { @@ -12,10 +12,19 @@ class Zotfinger { return false; } - if($channel) { + $m = parse_url($resource); + + $data = json_encode([ 'zot_token' => random_string() ]); + + if($channel && $m) { + $headers = [ - 'Accept' => 'application/x-zot+json', - 'X-Zot-Token' => random_string(), + 'Accept' => 'application/x-zot+json', + 'Content-Type' => 'application/x-zot+json', + 'X-Zot-Token' => random_string(), + 'Digest' => HTTPSig::generate_digest_header($data), + 'Host' => $m['host'], + '(request-target)' => 'post ' . get_request_string($resource) ]; $h = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel),false); } @@ -27,7 +36,9 @@ class Zotfinger { $redirects = 0; - $x = z_fetch_url($resource,false,$redirects, [ 'headers' => $h ] ); + $x = z_post_url($resource,$data,$redirects, [ 'headers' => $h ] ); + + logger('fetch: ' . print_r($x,true)); if($x['success']) { @@ -39,6 +50,8 @@ class Zotfinger { $result['data'] = json_decode(crypto_unencapsulate($result['data'],get_config('system','prvkey')),true); } + logger('decrypted: ' . print_r($result,true)); + return $result; } |