From e9177a1922f34ce225912c06dfd3e6c2b6dfb1b9 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Thu, 12 Mar 2009 21:17:00 +0100 Subject: [PATCH] fixed cookie handling in HTTPClient Ignore-this: bcdedaf795a2eb5fe89b2be4ca7b6dc1 darcs-hash:20090312201700-7ad00-7cc9ab34909ecdc42b6444c5ccb609d18bffe6f6.gz --- inc/HTTPClient.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 1184aebee..f59efbaf8 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -278,9 +278,18 @@ class HTTPClient { // handle headers and cookies $this->resp_headers = $this->_parseHeaders($r_headers); if(isset($this->resp_headers['set-cookie'])){ - foreach ((array) $this->resp_headers['set-cookie'] as $c){ - list($key, $value, $foo) = split('=', $cookie); - $this->cookies[$key] = $value; + foreach ((array) $this->resp_headers['set-cookie'] as $cookie){ + list($cookie) = explode(';',$cookie); + list($key,$val) = explode('=',$cookie); + $key = trim($key); + if($val == 'deleted'){ + if(isset($this->cookies[$key])){ + unset($this->cookies[$key]); + } + }elseif($key){ + if($key) $this->client->cookies[$key] = $val; + $this->cookies[$key] = $val; + } } } -- GitLab