summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-05-27 09:22:35 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-05-27 09:22:35 -0100
commit4878aa05e9d82a394efcd80c5abafc2db1527192 (patch)
treeee089936de6a2f6cf1d0eadacbfda1ed263cc479
parente72748fa0daa997a5f29bfc82b9e577fdb863c52 (diff)
also, try port 80 if 443 is not available
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/Service/CurlService.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php
index c554f666..7900649b 100644
--- a/lib/Service/CurlService.php
+++ b/lib/Service/CurlService.php
@@ -115,7 +115,14 @@ class CurlService {
$request->addData('resource', 'acct:' . $account);
$request->setAddress($host);
- $result = $this->request($request);
+ try {
+ $result = $this->request($request);
+ } catch (RequestNetworkException $e) {
+ if ($e->getCode() === CURLE_COULDNT_CONNECT) {
+ $request->setProtocol('http');
+ $result = $this->request($request);
+ } else throw $e;
+ }
return $result;
}
@@ -419,7 +426,7 @@ class CurlService {
throw new RequestNetworkException(
$errno . ' - ' . curl_error($curl) . ' - ' . json_encode(
$request, JSON_UNESCAPED_SLASHES
- )
+ ), $errno
);
}
}