+// trim(mb_convert_case($split[0], MB_CASE_TITLE, 'UTF-8'))
+
+function headers_render($header, $len)
+{
+ $cookies = "";
+
+ if (isset($header['Cookies'])) {
+ $cookies = $header['Cookies']->render();
+ unset($header['Cookies']);
+ }
+ if (isset($header['Location'])) {
+ header(sprintf("HTTP/1.1 302 OK\r\n%sLocation: %s", $cookies, $header['Location']));
+ }
+ else if (isset($header['HTTP-Response'])) {
+ header(sprintf("HTTP/1.1 %s", $header['HTTP-Response']));
+ foreach($header as $key => $value) {
+ if (strtolower($key) == "http-response")
+ continue;
+ header(sprintf("%s: %s", $key, $value));
+ }
+ if ($len >= 0) {
+ header(sprintf("Content-Length: %ld", $len));
+ }
+ }
+ else {
+ header("HTTP/1.1 200 OK\r\n");
+
+ if (!isset($header['Date']))
+ header(sprintf("Date: %s", date(DATE_RFC822)));
+ if (!isset($header['Connection']))
+ header("Connection: close");
+ if (!isset($header['Content-Type']))
+ header("Content-Type: text/html");
+ foreach($header as $key => $value) {
+ header(sprintf("%s: %s", $key, $value));
+ }
+ if ($len >= 0) {
+ header(sprintf("Content-Length: %d", $len));
+ }
+ else {
+ header("Cache-Control: no-cache, must-revalidate");
+ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+ if (!isset($header['Content-Encoding'])) {
+ header("Content-Encoding: chunked");
+ }
+ header("Transfer-Encoding: chunked");
+ }
+ header($cookies);
+ }
+
+ return (TRUE);
+}
+
+$transs = array( "iframe", "websocket", "xhr", "htmlfile" );