+ switch ($path) {
+ case "":
+ case "index.php":
+ ob_start();
+ bin5_index_main($transp_type, $header_out, $addr, $get, $post, $cookie);
+ $content = ob_get_contents();
+ ob_end_clean();
+
+ $s_a_p->pendpage_try_addflush($enc, $new_socket, 20, $header_out, $content);
+ return TRUE;
+
+ break;
+ case "index_wr.php":
+ // FIXME $content can be unset
+ if (isset($table_idx) && isset($table_token)) {
+ if (($bri = $s_a_p->app->match_get($table_idx, $table_token)) != FALSE) {
+ ob_start();
+ bin5_index_wr_main($bri, $addr, $get, $post, $cookie);
+ $content = ob_get_contents();
+ ob_end_clean();
+ }
+ else {
+ $content = "Bin5 Load data error";
+ }
+ }
+ else {
+ $content = "Bin5 Load data error";
+ }
+ $s_a_p->pendpage_try_addflush($enc, $new_socket, 20, $header_out, $content);
+ return TRUE;
+
+ break;
+ case "index_rd_ifra.php":
+ do {
+ if (!isset($table_idx)
+ || !isset($table_token)
+ || !isset($cookie['sess'])
+ || ($bri = $s_a_p->app->match_get($table_idx, $table_token)) == NULL
+ || (($user = $bri->get_user($cookie['sess'], $idx)) == FALSE)) {
+
+ $content = Bin5_user::stream_fini($transp_type, $s_a_p->rndstr, TRUE);
+ $s_a_p->pendpage_try_addflush($enc, $new_socket, 20, $header_out, $content);
+
+ return TRUE;
+ break;
+ }
+ // close a previous opened index_read_ifra socket, if exists
+ if (($prev = $user->rd_socket_get()) != NULL) {
+ $s_a_p->socks_unset($user->rd_socket_get());
+ fclose($user->rd_socket_get());
+ printf("CLOSE AND OPEN AGAIN ON IFRA2\n");
+ $user->rd_socket_set(NULL);
+ }
+
+ $content = "";
+ $user->stream_init($s_a_p->rndstr, $enc, $header_out, $content, $get, $post, $cookie);
+ $response = headers_render($header_out, -1).chunked_content($user->rd_zls_get(), $content);
+ $response_l = mb_strlen($response, "ASCII");
+
+ $wret = @fwrite($new_socket, $response, $response_l);
+ if ($wret < $response_l) {
+ printf("TROUBLES WITH FWRITE: %d\n", $wret);
+ $user->rd_cache_set(mb_substr($content, $wret, $response_l - $wret, "ASCII"));
+ }
+ else {
+ $user->rd_cache_set("");
+ }
+ fflush($new_socket);
+
+
+ $s_a_p->socks_set($new_socket, $user);
+ $user->rd_socket_set($new_socket);
+ printf(" - qui ci siamo - ");
+ return TRUE;
+ } while (FALSE);
+
+ return FALSE;
+ break;
+
+ default:
+ return FALSE;
+ break;
+ }
+