some fixes for xhr and iframe transport came to light after hunged stream test was...
[brisk.git] / web / Obj / transports.phh
index b426043..fcf1631 100644 (file)
@@ -31,7 +31,7 @@ class Transport_template {
     {
     }
 
-    static function fini($init_string, $blockerr)
+    static function fini($init_string, $base, $blockerr)
     {
     }
 
@@ -47,14 +47,24 @@ class Transport_xhr {
 
     function init($enc, &$header_out, $init_string, $base, $step)
     {
+        $ret = sprintf("@BEGIN@ /* %s */ @END@", $init_string);
+        if ($enc != 'plain')
+            $header_out['Content-Encoding'] = $enc;
+        $header_out['Cache-Control'] = 'no-cache, must-revalidate';     // HTTP/1.1
+        $header_out['Expires']       = 'Mon, 26 Jul 1997 05:00:00 GMT'; // Date in the past
+        $header_out['Content-type']  = 'application/xml; charset="utf-8"';
+
+        return ($ret);
     }
 
-    static function fini($init_string, $blockerr)
+    static function fini($init_string, $base, $blockerr)
     {
+        return ("");
     }
 
     function chunk($step, $cont)
     {
+        return ("@BEGIN@".$cont."@END@");
     }
 }
 
@@ -91,7 +101,7 @@ window.onload = function () { if (xynt_streaming != \"ready\") { xynt_streaming.
         return ($ret);
     }
 
-    static function fini($init_string, $blockerr)
+    static function fini($init_string, $base, $blockerr)
     {
         $ret = "";
         $ret .= sprintf("<html>
@@ -99,7 +109,7 @@ window.onload = function () { if (xynt_streaming != \"ready\") { xynt_streaming.
 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
 <script type=\"text/javascript\" src=\"%sxynt-streaming-ifra.js\"></script>
 <script type=\"text/javascript\">
-var xynt_streaming = \"ready\";", self::base_get(), self::base_get());
+var xynt_streaming = \"ready\";", $base, $base);
         $ret .= sprintf("
 window.onload = function () { if (xynt_streaming != \"ready\") { xynt_streaming.reload(); } };
 </script>
@@ -125,4 +135,8 @@ push(\"%s\");\n// -->\n</script>", $step, escpush($cont) );
         }
     }
 }
+
+class Transport_htmlfile extends Transport_iframe {
+}
+
 ?>
\ No newline at end of file