Handle dreambox web interface authentication errors
[playVideoOnDreamboxProxy.git] / www / play.php
index 5d631a00f1cef370e9e3b95f7d610f886d7ae009..36f3e6c56e7009e02144f488b9d675f943d28eb3 100644 (file)
@@ -21,18 +21,22 @@ playVideoOnDreambox($videoUrl, $dreamboxHost);
 
 function errorInput($msg)
 {
-    header('HTTP/1.0 400 Bad Request');
-    header('Content-type: text/plain');
+    if (!headers_sent()) {
+        header('HTTP/1.0 400 Bad Request');
+        header('Content-type: text/plain');
+    }
     echo $msg . "\n";
     exit(1);
 }
 
 function errorOut($msg, $httpStatus = '500 Internal Server Error')
 {
-    header('HTTP/1.0 ' . $httpStatus);
-    header('Content-type: text/plain');
+    if (!headers_sent()) {
+        header('HTTP/1.0 ' . $httpStatus);
+        header('Content-type: text/plain');
+    }
     echo $msg . "\n";
     syslog(LOG_ERR, 'playVideoOnDreamboxProxy: ' . $httpStatus . ': ' . $msg);
     exit(2);
 }
-?>
\ No newline at end of file
+?>