From d4e913d00e9e1abfdbe0ce0e4070cbcfb859f520 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Thu, 27 Dec 2018 15:38:36 +0000 Subject: [PATCH] httpclient : de-zip the content of the page if Content-Encoding = gzip git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4810 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- httpclient.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/httpclient.php b/httpclient.php index 43a51b6..f6b235f 100644 --- a/httpclient.php +++ b/httpclient.php @@ -723,6 +723,12 @@ class Httpclient if (strlen ($content) > $this->maxsize) throw new \Exception ("File to get exceeded maxsize", 500); } + if (key_exists ("Content-Encoding", $this->headersReceived)) + { + if ($this->headersReceived["Content-Encoding"] === "gzip" && + function_exists ("gzdecode")) + $content = gzdecode ($content); + } $this->disconnect (); if ($this->httpCode === 301 || $this->httpCode === 302 || key_exists ("Location", $this->headersReceived))