CC-5672: Webstream warnings on SaaS
Don't parse/use header info if get_headers returns false
This commit is contained in:
parent
c9d98e4e10
commit
7a04f7d98e
|
@ -360,21 +360,27 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
|
|
||||||
private static function discoverStreamMime($url)
|
private static function discoverStreamMime($url)
|
||||||
{
|
{
|
||||||
//TODO: What if invalid URL?
|
try {
|
||||||
$headers = get_headers($url);
|
$headers = @get_headers($url);
|
||||||
|
|
||||||
$headers = self::cleanHeaders($headers);
|
$mime = null;
|
||||||
|
$content_length_found = false;
|
||||||
$mime = null;
|
|
||||||
$content_length_found = false;
|
if ($headers !== false) {
|
||||||
foreach ($headers as $h) {
|
$headers = self::cleanHeaders($headers);
|
||||||
if (preg_match("/^content-type:/i", $h)) {
|
foreach ($headers as $h) {
|
||||||
list(, $value) = explode(":", $h, 2);
|
if (preg_match("/^content-type:/i", $h)) {
|
||||||
$mime = trim($value);
|
list(, $value) = explode(":", $h, 2);
|
||||||
}
|
$mime = trim($value);
|
||||||
if (preg_match("/^content-length:/i", $h)) {
|
}
|
||||||
$content_length_found = true;
|
if (preg_match("/^content-length:/i", $h)) {
|
||||||
|
$content_length_found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Logging::info("Invalid stream URL");
|
||||||
|
Logging::info($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($mime, $content_length_found);
|
return array($mime, $content_length_found);
|
||||||
|
|
Loading…
Reference in New Issue