diff options
-rw-r--r-- | inc/HTTPClient.php | 15 |
1 files 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; + } } } |