diff --git a/plugins/FeedsParser.inc b/plugins/FeedsParser.inc index 13fcaa0..a208ee8 100644 --- a/plugins/FeedsParser.inc +++ b/plugins/FeedsParser.inc @@ -264,7 +264,7 @@ class FeedsGeoTermElement extends FeedsTermElement { * Enclosure element, can be part of the result array. */ class FeedsEnclosure extends FeedsElement { - protected $mime_type; + protected $mime_type, $timeout; /** * Constructor, requires MIME type. @@ -288,6 +288,23 @@ class FeedsEnclosure extends FeedsElement { } /** + * @return + * Timeout in seconds to wait for an HTTP get request to finish. + */ + public function getTimeout() { + return $this->timeout; + } + + /** + * @param int $timeout + * Timeout in seconds to wait for an HTTP get request to finish. + */ + public function setTimeout($timeout) { + $this->timeout = $timeout; + } + + + /** * Use this method instead of FeedsElement::getValue() when fetching the file * from the URL. * @@ -319,7 +336,7 @@ class FeedsEnclosure extends FeedsElement { */ public function getContent() { feeds_include_library('http_request.inc', 'http_request'); - $result = http_request_get($this->getUrlEncodedValue()); + $result = http_request_get($this->getUrlEncodedValue(), NULL, NULL, NULL, $this->getTimeout()); if ($result->code != 200) { throw new Exception(t('Download of @url failed with code !code.', array('@url' => $this->getUrlEncodedValue(), '!code' => $result->code))); }