diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-12-11 17:07:08 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-12-11 20:14:01 +0300 |
commit | 2c2e1c4c7a94cdd3319c029e22e616df0853310e (patch) | |
tree | 9f83f04d1ed392cc26dfd750fad87c353e02f7d7 /apps/federation/lib | |
parent | ba3c608a00f3834f743de5a0cd82ddae3825d458 (diff) |
Catch the errors related to untrusted self signed certificates for federation
* Added tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/federation/lib')
-rw-r--r-- | apps/federation/lib/BackgroundJob/GetSharedSecret.php | 7 | ||||
-rw-r--r-- | apps/federation/lib/BackgroundJob/RequestSharedSecret.php | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php index 6090f521fcc..92bb31e369e 100644 --- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php @@ -32,6 +32,8 @@ namespace OCA\Federation\BackgroundJob; use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Ring\Exception\RingException; use OC\BackgroundJob\JobList; use OC\BackgroundJob\Job; use OCA\Federation\DbHandler; @@ -197,7 +199,10 @@ class GetSharedSecret extends Job { } else { $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); } - } catch (ConnectException $e) { + } catch (RequestException $e) { + $status = -1; // There is no status code if we could not connect + $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']); + } catch (RingException $e) { $status = -1; // There is no status code if we could not connect $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']); } catch (\Exception $e) { diff --git a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php index a201c9dccb6..ad7504da7ad 100644 --- a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php @@ -33,6 +33,8 @@ namespace OCA\Federation\BackgroundJob; use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Ring\Exception\RingException; use OC\BackgroundJob\JobList; use OC\BackgroundJob\Job; use OCA\Federation\DbHandler; @@ -197,7 +199,10 @@ class RequestSharedSecret extends Job { } else { $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); } - } catch (ConnectException $e) { + } catch (RequestException $e) { + $status = -1; // There is no status code if we could not connect + $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']); + } catch (RingException $e) { $status = -1; // There is no status code if we could not connect $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']); } catch (\Exception $e) { |