summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-07 13:32:30 +0100
committerSimon Rettberg2019-03-07 13:32:30 +0100
commitcaf173ab903d993aebdf137f3ca64f1ca73b74dc (patch)
tree70cc2fa2f4b1d25167a4b0b646b57b57ba78fe1a
parent[locationinfo] Add error log for backends (diff)
downloadslx-admin-caf173ab903d993aebdf137f3ca64f1ca73b74dc.tar.gz
slx-admin-caf173ab903d993aebdf137f3ca64f1ca73b74dc.tar.xz
slx-admin-caf173ab903d993aebdf137f3ca64f1ca73b74dc.zip
[locationinfo] Introduce timeouts for curl operations
-rw-r--r--modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php2
-rwxr-xr-xmodules-available/locationinfo/inc/coursebackend/coursebackend_exchange.inc.php2
-rw-r--r--modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php7
3 files changed, 8 insertions, 3 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php
index 2b2b9d00..0307a044 100644
--- a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php
@@ -83,6 +83,8 @@ class CourseBackend_Davinci extends CourseBackend
CURLOPT_SSL_VERIFYHOST => $this->verifyHostname ? 2 : 0,
CURLOPT_SSL_VERIFYPEER => $this->verifyCert ? 1 : 0,
CURLOPT_URL => $url,
+ CURLOPT_TIMEOUT => 15,
+ CURLOPT_CONNECTTIMEOUT => 3,
);
curl_setopt_array($this->curlHandle, $options);
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_exchange.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_exchange.inc.php
index c61c3f2f..ffbca17f 100755
--- a/modules-available/locationinfo/inc/coursebackend/coursebackend_exchange.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_exchange.inc.php
@@ -234,6 +234,8 @@ class CourseBackend_Exchange extends CourseBackend
$client->setCurlOptions(array(
CURLOPT_SSL_VERIFYPEER => $this->verifyHostname ? 2 : 0,
CURLOPT_SSL_VERIFYHOST => $this->verifyCert ? 1 : 0,
+ CURLOPT_TIMEOUT => 15,
+ CURLOPT_CONNECTTIMEOUT => 3,
));
return $client;
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
index 809634ad..7f84dd92 100644
--- a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
@@ -174,9 +174,8 @@ class CourseBackend_HisInOne extends CourseBackend
private function postToServer($request, $action)
{
$header = array(
- "Content-type: text/xml;charset=\"utf-8\"",
- "SOAPAction: \"" . $action . "\"",
- "Content-length: " . strlen($request),
+ 'Content-type: text/xml;charset="utf-8"',
+ 'SOAPAction: "' . $action . '"',
);
if ($this->curlHandle === false) {
@@ -191,6 +190,8 @@ class CourseBackend_HisInOne extends CourseBackend
CURLOPT_URL => $this->location,
CURLOPT_POSTFIELDS => $request,
CURLOPT_HTTPHEADER => $header,
+ CURLOPT_TIMEOUT => 15,
+ CURLOPT_CONNECTTIMEOUT => 3,
);
curl_setopt_array($this->curlHandle, $options);