From b5c1be34c2797f0866a3830fd5e7925c59a0bc14 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Fri, 23 Oct 2026 16:45:02 +0200 Subject: [PATCH] Don't inflate http response by default --- .../libraries/snappymail/http/response.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/http/response.php b/snappymail/v/0.0.0/app/libraries/snappymail/http/response.php index 18411512f..676b5c126 100644 --- a/snappymail/v/0.0.0/app/libraries/snappymail/http/response.php +++ b/snappymail/v/0.0.0/app/libraries/snappymail/http/response.php @@ -39,16 +39,7 @@ class Response $this->request_uri = $request_uri; $this->final_uri = $request_uri; $this->status = (int) $status; - if (\function_exists('gzinflate') && isset($this->headers['content-encoding']) - && (false !== \stripos($this->headers['content-encoding'], 'gzip'))) { - $this->body = \gzinflate(\substr($body, 10, -4)); - if (false === $this->body) { - $err = \error_get_last() ?: ['message' => 'gzinflate failed']; - throw new \RuntimeException("{$err['message']} for {$request_uri}"); - } - } else { - $this->body = $body; - } + $this->body = $body; } function __get($k) @@ -56,6 +47,20 @@ class Response return \property_exists($this, $k) ? $this->$k : null; } + public function decoded()/*: string|false*/ + { + $body = $this->body; + if (\function_exists('gzinflate') && isset($this->headers['content-encoding']) + && (false !== \stripos($this->headers['content-encoding'], 'gzip'))) { + $body = \gzinflate(\substr($body, 10, -4)); + if (false === $body) { + $err = \error_get_last() ?: ['message' => 'gzinflate failed']; + throw new \RuntimeException("{$err['message']} for {$request_uri}"); + } + } + return $body; + } + /** * returns string, array or null */