protected function sendGzipContent($event, $req, $res, $path, $filesize)
    {
        if(!$this->gzip || !$req->gzipSupport() || $filesize < $this->gzip_min_bytes || $filesize >$this->gzip_max_bytes) {
            return false;
        }
        
        $res->headers->set('Content-Encoding', 'gzip');
        $res->body = gzencode(file_get_contents($path), $this->gzip_level);
        $res->headers->set('Content-Length', strlen($res->body));
        return $res;
    }