summaryrefslogtreecommitdiffstats
path: root/lib/private/Share/Share.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Share/Share.php')
-rw-r--r--lib/private/Share/Share.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index e6056679c1c..4514cdbae1b 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -1991,7 +1991,22 @@ class Share extends Constants {
while ($result['success'] === false && $try < 2) {
$federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING');
$endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares';
- $result = \OC::$server->getHTTPHelper()->post($protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, $fields);
+ $client = \OC::$server->getHTTPClientService()->newClient();
+
+ try {
+ $response = $client->post(
+ $protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT,
+ [
+ 'body' => $fields,
+ 'connect_timeout' => 10,
+ ]
+ );
+
+ $result = ['success' => true, 'result' => $response->getBody()];
+ } catch (\Exception $e) {
+ $result = ['success' => false, 'result' => $e->getMessage()];
+ }
+
$try++;
$protocol = 'http://';
}