From 98b23955143c909892bd2006bd3f0cad32f690db Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 26 May 2020 03:30:30 +0200 Subject: allow custom errors on format violations (e.g. timewindow) --- it_url.class | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/it_url.class b/it_url.class index 5d7b4dd..29429d2 100644 --- a/it_url.class +++ b/it_url.class @@ -81,7 +81,7 @@ function is_reachable($timeout = 5) static function _postprocess($data, $p) { if ($p['postprocess']) - $data = ($t = $p['postprocess']($data, ['it_error' => $p['retries'] > 0 ? false : ['title' => "invalid content from " . $p['url']]])) && $p['checkonly'] ? $data : $t; + $data = ($t = $p['postprocess']($data, ['it_error' => $p['retries'] > 0 ? false : (array)$p['it_error'] + ['title' => "invalid content from " . $p['url']]])) && $p['checkonly'] ? $data : $t; return $data; } @@ -409,7 +409,7 @@ static function get_multi($p=null) $key = $keys[$info['handle']]; $content = curl_multi_getcontent($info['handle']); if (isset($p['postprocess'])) - $content = $p['postprocess']($content, ['it_error' => $retries[$key] < $p['retries'] ? false : ['title' => "invalid content from " . $urls[$key]]]); + $content = $p['postprocess']($content, ['it_error' => $retries[$key] < $p['retries'] ? false : (array)$p['it_error'] + ['title' => "invalid content from " . $urls[$key]]]); EDC('reqtimings', $key, $info['result'], (gettimeofday(true) - $start) * 1000); if ($info['result'] == CURLE_OK && $content !== null) { -- cgit v1.2.3