summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/js/setupchecks.js2
-rw-r--r--core/js/tests/specs/setupchecksSpec.js6
-rw-r--r--lib/private/AppFramework/Http/Dispatcher.php8
-rw-r--r--lib/private/AppFramework/Middleware/OCSMiddleware.php2
-rw-r--r--lib/public/AppFramework/Controller.php7
-rw-r--r--lib/public/AppFramework/OCSController.php14
-rw-r--r--settings/Controller/CheckSetupController.php26
7 files changed, 52 insertions, 13 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index 280c8d08c99..1f18c7b6fa7 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -94,7 +94,7 @@
if (xhr.status === 200 && data) {
if (!data.serverHasInternetConnection) {
messages.push({
- msg: t('core', 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.'),
+ msg: t('core', 'This server has no working Internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.'),
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js
index 172e6e27135..7c59094caac 100644
--- a/core/js/tests/specs/setupchecksSpec.js
+++ b/core/js/tests/specs/setupchecksSpec.js
@@ -161,7 +161,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){
expect(data).toEqual([
{
- msg: 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
+ msg: 'This server has no working Internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
}, {
msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" rel="noreferrer" href="https://doc.owncloud.org/server/go.php?to=admin-performance">documentation</a>.',
@@ -192,7 +192,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){
expect(data).toEqual([
{
- msg: 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
+ msg: 'This server has no working Internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
},
{
@@ -224,7 +224,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){
expect(data).toEqual([
{
- msg: 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
+ msg: 'This server has no working Internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
}
]);
diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php
index 0d502462d0e..28b88cf9eb1 100644
--- a/lib/private/AppFramework/Http/Dispatcher.php
+++ b/lib/private/AppFramework/Http/Dispatcher.php
@@ -168,10 +168,14 @@ class Dispatcher {
// if none is given try the first Accept header
if($format === null) {
$headers = $this->request->getHeader('Accept');
- $format = $controller->getResponderByHTTPHeader($headers);
+ $format = $controller->getResponderByHTTPHeader($headers, null);
}
- $response = $controller->buildResponse($response, $format);
+ if ($format !== null) {
+ $response = $controller->buildResponse($response, $format);
+ } else {
+ $response = $controller->buildResponse($response);
+ }
}
return $response;
diff --git a/lib/private/AppFramework/Middleware/OCSMiddleware.php b/lib/private/AppFramework/Middleware/OCSMiddleware.php
index f72c7c2ff2d..90355a39ef0 100644
--- a/lib/private/AppFramework/Middleware/OCSMiddleware.php
+++ b/lib/private/AppFramework/Middleware/OCSMiddleware.php
@@ -73,7 +73,7 @@ class OCSMiddleware extends Middleware {
// if none is given try the first Accept header
if($format === null) {
$headers = $this->request->getHeader('Accept');
- $format = $controller->getResponderByHTTPHeader($headers);
+ $format = $controller->getResponderByHTTPHeader($headers, 'xml');
}
return $format;
diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php
index 05c2f090925..f730799bece 100644
--- a/lib/public/AppFramework/Controller.php
+++ b/lib/public/AppFramework/Controller.php
@@ -105,8 +105,9 @@ abstract class Controller {
* @param string $acceptHeader
* @return string the responder type
* @since 7.0.0
+ * @since 9.1.0 Added default parameter
*/
- public function getResponderByHTTPHeader($acceptHeader) {
+ public function getResponderByHTTPHeader($acceptHeader, $default='json') {
$headers = explode(',', $acceptHeader);
// return the first matching responder
@@ -120,8 +121,8 @@ abstract class Controller {
}
}
- // no matching header defaults to json
- return 'json';
+ // no matching header return default
+ return $default;
}
diff --git a/lib/public/AppFramework/OCSController.php b/lib/public/AppFramework/OCSController.php
index ee9eaae52f1..bd50f0a4017 100644
--- a/lib/public/AppFramework/OCSController.php
+++ b/lib/public/AppFramework/OCSController.php
@@ -32,6 +32,7 @@ namespace OCP\AppFramework;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\OCSResponse;
+use OCP\AppFramework\Http\Response;
use OCP\IRequest;
@@ -70,6 +71,19 @@ abstract class OCSController extends ApiController {
});
}
+ /**
+ * Since the OCS endpoints default to XML we need to find out the format
+ * again
+ * @param mixed $response the value that was returned from a controller and
+ * is not a Response instance
+ * @param string $format the format for which a formatter has been registered
+ * @throws \DomainException if format does not match a registered formatter
+ * @return Response
+ * @since 9.1.0
+ */
+ public function buildResponse($response, $format = 'xml') {
+ return parent::buildResponse($response, $format);
+ }
/**
* Unwrap data and build ocs response
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php
index 4d9ad476516..bfb83e91936 100644
--- a/settings/Controller/CheckSetupController.php
+++ b/settings/Controller/CheckSetupController.php
@@ -93,14 +93,34 @@ class CheckSetupController extends Controller {
return false;
}
+ $siteArray = ['www.nextcloud.com',
+ 'www.google.com',
+ 'www.github.com'];
+
+ foreach($siteArray as $site) {
+ if ($this->isSiteReachable($site)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Chceks if the ownCloud server can connect to a specific URL using both HTTPS and HTTP
+ * @return bool
+ */
+ private function isSiteReachable($sitename) {
+ $httpSiteName = 'http://' . $sitename . '/';
+ $httpsSiteName = 'https://' . $sitename . '/';
+
try {
$client = $this->clientService->newClient();
- $client->get('https://www.owncloud.org/');
- $client->get('http://www.owncloud.org/');
- return true;
+ $client->get($httpSiteName);
+ $client->get($httpsSiteName);
} catch (\Exception $e) {
return false;
}
+ return true;
}
/**