Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #1441 from Scheirle/ispdb_timeout
Browse files Browse the repository at this point in the history
Adds a timeout to the ispdb autoconfig query.
  • Loading branch information
ChristophWurst committed Apr 23, 2016
2 parents edeca8a + 0ae83db commit c3c435b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/service/autoconfig/ispdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,19 @@ public function __construct(Logger $logger) {

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 [];
}
Expand Down

0 comments on commit c3c435b

Please sign in to comment.