diff options
author | Andreas Gohr <andi@splitbrain.org> | 2009-03-12 21:17:00 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2009-03-12 21:17:00 +0100 |
commit | e9177a1922f34ce225912c06dfd3e6c2b6dfb1b9 (patch) | |
tree | 9df8ececa1348b299e03aec212bc76c11f74cedb /inc/HTTPClient.php | |
parent | f0acc9bffc02e77fb1db1cf3aeea7034e024ad5c (diff) | |
download | rpg-e9177a1922f34ce225912c06dfd3e6c2b6dfb1b9.tar.gz rpg-e9177a1922f34ce225912c06dfd3e6c2b6dfb1b9.tar.bz2 |
fixed cookie handling in HTTPClient
Ignore-this: bcdedaf795a2eb5fe89b2be4ca7b6dc1
darcs-hash:20090312201700-7ad00-7cc9ab34909ecdc42b6444c5ccb609d18bffe6f6.gz
Diffstat (limited to 'inc/HTTPClient.php')
-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; + } } } |