summaryrefslogtreecommitdiff
path: root/it_url.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_url.class')
-rw-r--r--it_url.class30
1 files changed, 19 insertions, 11 deletions
diff --git a/it_url.class b/it_url.class
index 5973887..c465f13 100644
--- a/it_url.class
+++ b/it_url.class
@@ -380,13 +380,18 @@ function request($p=array())
}
@fclose($fp);
- }
+ } else
+ $this->errstr = $errstr;
- if (time() >= $endtime)
+ if (time() >= $endtime) {
$result = $this->result = false;
+ $errstr = $this->errstr = "totaltimeout reached";
+ }
- if ($p['maxlength'] && (strlen($this->data) + $len > $p['maxlength']))
+ if ($p['maxlength'] && (strlen($this->data) + $len > $p['maxlength'])) {
$result = $this->result = false;
+ $errstr = $this->errstr = "maxlength reached";
+ }
if ($result === false && $p['safety'] == 1)
it::error(array('title' => "problem (timeout?) getting $url->url " . $errstr) + (array)$p['it_error']);
@@ -461,21 +466,24 @@ function request_curl($p=array())
EDC('curlinfo', curl_getinfo($curl));
- if ($got === false && $p['safety'] == 1)
- it::error(array('title' => "problem getting $url->url with curl: " . curl_error($curl)) + (array)$p['it_error']);
-
if ($got) {
list($url->header, $url->data) = explode("\r\n\r\n", $got, 2);
$url->header .= "\r\n\r\n";
$url->parse_http_header($url->header);
- if ($p['maxlength'] && (strlen($this->data) > $p['maxlength']))
- $result = false;
- else
+ if ($p['maxlength'] && (strlen($this->data) > $p['maxlength'])) {
+ $result = $this->result = false;
+ $errstr = $this->errstr = "maxlength reached";
+ } else
$result =& $url->data;
- } else
- $result = false;
+ } else {
+ $result = $this->result = false;
+ $errstr = $this->errstr = curl_error($curl);
+ }
+
+ if ($got === false && $p['safety'] == 1)
+ it::error(array('title' => "problem getting $url->url with curl: " . curl_error($curl)) + (array)$p['it_error']);
return $result;
}