function headers_render($header, $len)
{
-
$s = "";
- $s .= "HTTP/1.1 200 OK\r\n";
+ if (isset($header['Location'])) {
+ return sprintf("HTTP/1.1 302 OK\r\nLocation: %s\r\n\r\n", $header['Location']);
+ }
+ else {
+ $s .= "HTTP/1.1 200 OK\r\n";
+ }
if (!isset($header['Date']))
$s .= sprintf("Date: %s\r\n", date(DATE_RFC822));
if (!isset($header['Connection']))
}
}
+ /*
+ $response: raw stream data not sent
+ $content: html consistent data (<script bla bla>)
+ $user->stream_keepalive($w_ping) ping srv->cli OR srv->cli + cli->srv if $w_ping == TRUE
+ */
+
/* manage open streaming */
foreach ($this->socks as $k => $sock) {
if (isset($this->s2u[intval($sock)])) {
$content = "";
$user->stream_main($content, $get, $post, $cookie);
printf("[%s] [%d] [%d]\n", $user->name, $user->lacc, $this->curtime);
- if ($content == "" && $user->ping_req == FALSE
+ if (/* $content == "" && */ $user->ping_req == FALSE
&& (($this->curtime - $user->lacc) > (EXPIRE_TIME_RD / 2))) {
- $content = $user->stream_ping();
+ // $content = $user->stream_keepalive(TRUE);
+ $content += $user->stream_keepalive(TRUE);
$user->ping_req = TRUE;
}
if ($content == "" && $user->rd_kalive_is_expired($this->curtime)) {
- $content = $user->stream_keepalive();
+ $content = $user->stream_keepalive(FALSE);
}
if ($content != "") {
$response = chunked_content($content);