X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fuser.phh;h=d42d0de4f5d83bd6812ae7e895dc73358daefa7e;hb=879ef1677b59eb159d0b9982a8fb5b056f13bff7;hp=2b28adb6c4a78764f564ce441bc729556fcd71f9;hpb=324d94cde1e6af57f937f4660484d15b740bc348;p=brisk.git diff --git a/web/Obj/user.phh b/web/Obj/user.phh index 2b28adb..d42d0de 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -97,6 +97,7 @@ class User { var $rd_scristp; // current script step (for each session) var $rd_kalive; // if no message are sent after RD_KEEPALIVE_TOUT secs we send a keepalive from server var $rd_cache; // place where store failed fwrite data + var $rd_zls; // zlibstream object handle if compressed stream, else FALSE var $comm; // commands array // var $asta_card; // @@ -154,6 +155,7 @@ class User { $thiz->rd_scristp = -1; $thiz->rd_kalive = -1; $thiz->rd_cache = ""; + $thiz->rd_zls = FALSE; $thiz->asta_card = -2; $thiz->asta_pnt = -1; @@ -287,7 +289,7 @@ class User { return ($thiz); } - function rd_data_set($curtime, $stat, $subst, $step, $from) + function rd_data_set($curtime, $enc, $stat, $subst, $step, $from) { $this->rd_endtime = $curtime + RD_ENDTIME_DELTA; $this->rd_stat = $stat; @@ -296,6 +298,7 @@ class User { $this->rd_from = $from; $this->rd_scristp = 0; $this->rd_kalive = $curtime + RD_KEEPALIVE_TOUT; + $this->rd_zls = ZLibStream::create($enc); } function rd_socket_get() { @@ -303,6 +306,12 @@ class User { } function rd_socket_set($sock) { + if ($sock == NULL) { + if ($this->rd_zls) { + $this->rd_zls->destroy(); + $this->rd_zls = FALSE; + } + } $this->rd_socket = $sock; } @@ -343,6 +352,11 @@ class User { $this->rd_cache = $cache; } + function rd_zls_get() + { + return ($this->rd_zls); + } + function idx_get() { return ($this->idx); } @@ -573,25 +587,18 @@ class User { protected function blocking_error($is_unrecoverable) { - GLOBAL $is_page_streaming; - - $is_page_streaming = TRUE; log_crit("BLOCKING_ERROR UNREC: ".($is_unrecoverable ? "TRUE" : "FALSE")); - return (sprintf(($is_unrecoverable ? 'hstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");')); + return (sprintf(($is_unrecoverable ? 'xstm.stop(); ' : '').'window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");')); } // FIXME TO SUPPORT iframe protected function page_sync($sess, $page, $table_idx, $table_token) { - GLOBAL $is_page_streaming; - // log_rd2("page_sync:".var_export(debug_backtrace())); - $is_page_streaming = TRUE; - log_rd2("PAGE_SYNC"); printf("xXx USER::PAGE_SYNC [%s]\n", get_class($this)); - return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); hstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("%s");', $table_idx, $table_token, $page)); + return (sprintf('createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); xstm.stop(); window.onunload = null; window.onbeforeunload = null; document.location.assign("%s");', $table_idx, $table_token, $page)); } @@ -599,7 +606,7 @@ class User { protected function maincheck($cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $splashdate, $table_idx, $table_token) { - GLOBAL $G_lang, $mlang_indrd, $is_page_streaming; + GLOBAL $G_lang, $mlang_indrd; // GLOBAL $first_loop; GLOBAL $G_with_splash, $G_splash_content, $G_splash_interval, $G_splash_idx; GLOBAL $G_splash_w, $G_splash_h, $G_splash_timeout; @@ -626,10 +633,9 @@ class User { $S_load_stat['wR_minusone']++; - if ($this->the_end == TRUE) { - // log_rd2("main_check: the end".var_export(debug_backtrace())); - $is_page_streaming = TRUE; - } + // if ($this->the_end == TRUE) { + // log_rd2("main_check: the end".var_export(debug_backtrace())); + // } if ($this->trans_step != -1) { log_rd2("TRANS USATO ".$this->trans_step); @@ -741,16 +747,18 @@ class User { public static function stream_fini($init_string, $is_unrecoverable) { + printf("xXx user::stream_fini\n"); + // IF IFRAME THEN: $body = ""; $body .= sprintf(" - + "); @@ -774,20 +782,22 @@ push(\"%s\"); stat step */ -function stream_init($init_string, &$header_out, &$body, $get, $post, $cookie) +function stream_init($init_string, $enc, &$header_out, &$body, $get, $post, $cookie) { $curtime = time(); - + printf("CLASS: [%s] base: [%s]\n", get_class($this), self::base_get()); + + // (webservers_exceeded() || stristr($HTTP_USER_AGENT, "Mozilla/5.0 (Windows NT 6.1; rv:5.0)") || stristr($HTTP_USER_AGENT, "MSIE") || stristr($HTTP_USER_AGENT, "CHROME") ? TRUE : FALSE); - $is_page_streaming = FALSE; // (webservers_exceeded() || stristr($HTTP_USER_AGENT, "Mozilla/5.0 (Windows NT 6.1; rv:5.0)") || stristr($HTTP_USER_AGENT, "MSIE") || stristr($HTTP_USER_AGENT, "CHROME") ? TRUE : FALSE); - + 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'] = 'text/html; charset="utf-8"'; - + log_load("index_rd_ifra_init.php"); - + if (($from = gpcs_var('from', $get, $post, $cookie)) === FALSE) $from = ""; if (($stat = gpcs_var('stat', $get, $post, $cookie)) === FALSE) @@ -797,30 +807,30 @@ function stream_init($init_string, &$header_out, &$body, $get, $post, $cookie) if (($step = gpcs_var('step', $get, $post, $cookie)) === FALSE) unset($step); - $this->rd_data_set($curtime, $stat, $subst, $step, $from); + $this->rd_data_set($curtime, $enc, $stat, $subst, $step, $from); $cc = get_called_class(); - + $body .= sprintf(" - + "); $body .= sprintf("\n", $init_string); - + return TRUE; -} + } function stream_main(&$body, $get, $post, $cookie) { - GLOBAL $is_page_streaming, $G_splash_idx; + GLOBAL $G_splash_idx; $CO_splashdate = "CO_splashdate".$G_splash_idx; if (($splashdate = gpcs_var("$CO_splashdate", $get, $post, $cookie)) === FALSE) @@ -830,8 +840,7 @@ function stream_main(&$body, $get, $post, $cookie) if (($table_token = gpcs_var("table_token", $get, $post, $cookie)) === FALSE) $table_token = ""; - $is_page_streaming = FALSE; - log_rd2("FROM OUTSIDE - STAT: ".$this->rd_stat." SUBST: ".$this->rd_subst." STEP: ".$this->rd_step." FROM: ".$this->rd_from. "IS_PAGE:" . $is_page_streaming); + log_rd2("FROM OUTSIDE - STAT: ".$this->rd_stat." SUBST: ".$this->rd_subst." STEP: ".$this->rd_step." FROM: ".$this->rd_from); $pre_main = gettimeofday(TRUE); @@ -847,8 +856,6 @@ push(\"%s\"); ", $this->rd_scristp++, escpush($ret) ); log_rd2(0, 'index_rd.php: after mop_flush (begin: '.sprintf("%f", $pre_main).')'); - if ($is_page_streaming) - return TRUE; } printf("xXx POST: rd_step %d\n", $this->rd_step);