Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Scheirle <bernhard+git@scheirle.de>2016-04-21 23:24:00 +0300
committerBernhard Scheirle <bernhard+git@scheirle.de>2016-04-22 13:47:38 +0300
commit0ae83db3b389ab237c2619e353c6011fdade3563 (patch)
tree4955bd1d9d0ec02f7f549c6c1710142fa004d2cf
parentedeca8a0769af9d7e6e382baa19e6b708517e3ce (diff)
Adds a timeout to the ispdb autoconfig query. Fixes #1417
-rw-r--r--lib/service/autoconfig/ispdb.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/service/autoconfig/ispdb.php b/lib/service/autoconfig/ispdb.php
index 3e96c50ae..9babc9b43 100644
--- a/lib/service/autoconfig/ispdb.php
+++ b/lib/service/autoconfig/ispdb.php
@@ -48,8 +48,19 @@ class IspDb {
private function queryUrl($url) {
try {
- $xml = @simplexml_load_file($url);
- if (libxml_get_last_error() !== False || !is_object($xml) || !$xml->emailProvider) {
+ $content = @file_get_contents($url, false, stream_context_create([
+ 'http' => [
+ 'timeout' => 7
+ ]
+ ]));
+ if ($content !== false) {
+ $xml = @simplexml_load_string($content);
+ } else {
+ $this->logger->debug("IsbDb: <$url> request timed out");
+ return [];
+ }
+
+ if (libxml_get_last_error() !== false || !is_object($xml) || !$xml->emailProvider) {
libxml_clear_errors();
return [];
}