+ }
+
+ static function pendingpage_continue($socket, $curtime, $kalive, $method,
+ $header, $get, $post, $cookie,
+ $path, $addr, $rest, $cont)
+ {
+ $thiz = static::pendingpage_staminal($socket, PENDINGPAGE_CONTINUE, $curtime, $kalive, $method,
+ $header, $get, $post, $cookie, $path, $addr, $rest, $cont);
+ $thiz->to_continuing();
+
+ return $thiz;
+ }
+
+ function context_get(&$header, &$socket, &$path, &$addr, &$get, &$post, &$cookie)
+ {
+ $header = $this->header;
+ $socket = $this->socket;
+ $path = $this->path;
+ $addr = $this->addr;
+ $get = $this->get;
+ post_manage($post, $this->cont);
+ $cookie = $this->cookie;
+ fprintf(STDERR, "SOCKET GET: %s\n", $this->socket);
+ }
+
+ function to_continuing()
+ {
+ printf("TRY FLUSH CREATE\n");
+ $header = array();
+ $header['HTTP-Response'] = "100 Continue";
+ $hea = headers_render($header, 0);
+ $hea_sz = mb_strlen($hea, "ASCII");
+
+ $this->status = PENDINGPAGE_CONTINUE;
+ $this->msg = $hea;
+ $this->msg_sz = $hea_sz;
+ }
+
+ static function pendingpage_waiting($socket, $curtime, $kalive, $method, $header,
+ $get, $post, $cookie, $path, $addr, $rest, $cont)
+ {
+ return (static::pendingpage_staminal($socket, PENDINGPAGE_WAITDATA, $curtime, $kalive, $method,
+ $header, $get, $post, $cookie, $path, $addr, $rest, $cont));
+ }
+
+ static function pendingpage_staminal($socket, $status, $curtime, $kalive, $method, $header,
+ $get, $post, $cookie, $path, $addr, $rest, $cont)
+ {
+ $thiz = new PendingPage($socket, $curtime, $kalive);
+ $thiz->status = $status;
+
+ $thiz->method = $method;
+ $thiz->header = $header;
+ $thiz->get = $get;
+ $thiz->post = $post;
+ $thiz->cookie = $cookie;
+ $thiz->path = $path;
+ $thiz->addr = $addr;
+ $thiz->contsz = $header['Content-Length'];
+ $thiz->rest = $rest;
+ $thiz->cont = $cont;
+
+ return ($thiz);
+ }
+
+ function try_wait($curtime)
+ {
+ // if completed return TRUE to allow data to be processed,
+ // if timeout or max content dimension is exceeded move to flushing
+ }
+
+ static function pendingpage_flushing($socket, $curtime, $kalive, $enc, $header_out, $body)
+ {
+ $thiz = new PendingPage($socket, $curtime, $kalive);
+
+ $thiz->to_flushing($enc, $header_out, $body);
+
+ return ($thiz);
+ }
+
+ function to_flushing($enc, &$header_out, $body)
+ {
+ printf("TRY FLUSH CREATE: enc[%s]\n", $enc);
+ $body_out = ZLibStream::compress($enc, $body);
+ if ($enc != 'plain')
+ $header_out['Content-Encoding'] = $enc;
+ $body_out_sz = mb_strlen($body_out, "ASCII");
+ $hea = headers_render($header_out, $body_out_sz);
+ $hea_sz = mb_strlen($hea, "ASCII");
+
+ $this->status = PENDINGPAGE_FLUSH;
+ $this->msg = $hea.$body_out;
+ $this->msg_sz = $hea_sz + $body_out_sz;
+ printf("TRY FLUSH CREATE: enc[%s]\n", $enc);