public function out($s, $flush = true)
{
if ($flush) {
if (!Daemon::$obInStack) {
// preventing recursion
ob_flush();
}
}
if ($this->aborted) {
return false;
}
if (!isset($this->upstream)) {
return false;
}
$l = mb_orig_strlen($s);
$this->responseLength += $l;
$this->ensureSentHeaders();
if ($this->attrs->chunked) {
for ($o = 0; $o < $l;) {
$c = min($this->upstream->pool->config->chunksize->value, $l - $o);
$chunk = dechex($c) . "\r\n" . ($c === $l ? $s : mb_orig_substr($s, $o, $c)) . "\r\n";
if ($this->sendfp) {
$this->sendfp->write($chunk);
} else {
$this->upstream->requestOut($this, $chunk);
}
$o += $c;
}
return true;
} else {
if ($this->sendfp) {
$this->sendfp->write($s);
return true;
}
if (Daemon::$compatMode) {
echo $s;
return true;
}
return $this->upstream->requestOut($this, $s);
}
}