From 730b84040935cf2964251cd400f6a9d8fccdc88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 6 Sep 2021 17:33:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-server/Message/Stream.php | 4 ++-- http-server/Service/Http.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/http-server/Message/Stream.php b/http-server/Message/Stream.php index c7ba2bc6..c1ed7288 100644 --- a/http-server/Message/Stream.php +++ b/http-server/Message/Stream.php @@ -134,7 +134,7 @@ class Stream implements StreamInterface public function write($string): int { $this->body = $string; - $this->size = 0; + $this->size = strlen($this->body); return $this->size; } @@ -146,7 +146,7 @@ class Stream implements StreamInterface public function append(string $string): int { $this->body .= $string; - $this->size = 0; + $this->size = strlen($this->body); return $this->size; } diff --git a/http-server/Service/Http.php b/http-server/Service/Http.php index 34919bf7..5fb0bc70 100644 --- a/http-server/Service/Http.php +++ b/http-server/Service/Http.php @@ -75,7 +75,7 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect $responseData = Help::toXml($responseData); } if (is_array($responseData)) { - $interface->stream->write(json_encode($responseData, JSON_UNESCAPED_UNICODE)); + $interface->stream->write(json_encode($responseData)); } else { $interface->stream->write((string)$responseData); }