]> git.mxchange.org Git - friendica.git/commitdiff
Issue 14175: Fix problems with upper case host names
authorMichael <heluecht@pirati.ca>
Sat, 25 May 2024 18:58:48 +0000 (18:58 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 25 May 2024 19:00:53 +0000 (19:00 +0000)
src/Model/APContact.php
src/Util/HTTPSignature.php

index dd778ef37380238d7371a4fa9586587b187e846c..618304605da7dde5d0c04b311ba481c74d865eb1 100644 (file)
@@ -84,13 +84,9 @@ class APContact
 
                        if (!empty($link['template']) && ($link['rel'] == ActivityNamespace::OSTATUSSUB)) {
                                $data['subscribe'] = $link['template'];
-                       }
-
-                       if (!empty($link['href']) && !empty($link['type']) && ($link['rel'] == 'self') && ($link['type'] == 'application/activity+json')) {
+                       } elseif (!empty($link['href']) && !empty($link['type']) && ($link['rel'] == 'self') && ($link['type'] == 'application/activity+json')) {
                                $data['url'] = $link['href'];
-                       }
-
-                       if (!empty($link['href']) && !empty($link['type']) && ($link['rel'] == ActivityNamespace::WEBFINGERPROFILE) && ($link['type'] == 'text/html')) {
+                       } elseif (!empty($link['href']) && !empty($link['type']) && ($link['rel'] == ActivityNamespace::WEBFINGERPROFILE) && ($link['type'] == 'text/html')) {
                                $data['alias'] = $link['href'];
                        }
                }
@@ -199,7 +195,7 @@ class APContact
                                $failed = empty($curlResult) || empty($curlResult->getBodyString()) ||
                                        (!$curlResult->isSuccess() && ($curlResult->getReturnCode() != 410));
 
-                               if (!$failed) {
+                                       if (!$failed) {
                                        $data = json_decode($curlResult->getBodyString(), true);
                                        $failed = empty($data) || !is_array($data);
                                }
index 82ee1981f1c59dd4cc9b48b5f637fec328bfe3c7..2cb224ef6fa2eee8ae3416443ee6ce111212c137 100644 (file)
@@ -281,7 +281,7 @@ class HTTPSignature
                $content = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
 
                // Header data that is about to be signed.
-               $host = parse_url($target, PHP_URL_HOST);
+               $host = strtolower(parse_url($target, PHP_URL_HOST));
                $path = parse_url($target, PHP_URL_PATH);
                $digest = 'SHA-256=' . base64_encode(hash('sha256', $content, true));
                $content_length = strlen($content);
@@ -502,7 +502,7 @@ class HTTPSignature
 
                if (!empty($owner['uprvkey'])) {
                        // Header data that is about to be signed.
-                       $host = parse_url($request, PHP_URL_HOST);
+                       $host = strtolower(parse_url($request, PHP_URL_HOST));
                        $path = parse_url($request, PHP_URL_PATH);
                        $date = DateTimeFormat::utcNow(DateTimeFormat::HTTP);