diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index 1184aebeeb8608d79d7c4e064453ba165a632d90..f59efbaf8765f9c3663cf5f910cc6dc57e2ce92f 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;
+                }
             }
         }