httpclient : cookies was removed if the expire was not correctely set
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4806 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -97,7 +97,16 @@ class Httpclient
|
||||
|
||||
/** The accept type of data wanted by the client
|
||||
*/
|
||||
private $accept = "text/html;q=0.9, */*;q=0.8";
|
||||
private $accept = "text/html,application/xhtml+xml,application/xml;q=0.9,".
|
||||
"*/*;q=0.8";
|
||||
|
||||
/** The accept language wanted by the client
|
||||
*/
|
||||
private $acceptLanguage = "en-us,en;q=0.5";
|
||||
|
||||
/** The accept encoding wanted by the client
|
||||
*/
|
||||
private $acceptEncoding = "gzip, deflate";
|
||||
|
||||
// }}}
|
||||
|
||||
@@ -344,6 +353,31 @@ class Httpclient
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Get/Set the accept Language wanted by the client
|
||||
* @param string|null $acceptLanguage The languages with weight
|
||||
*/
|
||||
public function acceptLanguage ($acceptLanguage = null)
|
||||
// {{{
|
||||
{
|
||||
if ($acceptLanguage === null)
|
||||
return $this->acceptLanguage;
|
||||
$this->acceptLanguage = $acceptLanguage;
|
||||
return $this;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Get/Set the accept Encoding wanted by the client
|
||||
* @param string|null $acceptEncoding The encoding requested
|
||||
*/
|
||||
public function acceptEncoding ($acceptEncoding = null)
|
||||
// {{{
|
||||
{
|
||||
if ($acceptEncoding === null)
|
||||
return $this->acceptEncoding;
|
||||
$this->acceptEncoding = $acceptEncoding;
|
||||
return $this;
|
||||
}
|
||||
// }}}
|
||||
//////////////////////////////////
|
||||
//// THE ACTIVE METHODS ////
|
||||
//////////////////////////////////
|
||||
@@ -475,6 +509,10 @@ class Httpclient
|
||||
$this->headersSent = array ();
|
||||
$this->headersSent[] = "$this->method $path HTTP/1.1";
|
||||
$this->headersSent[] = "Host: ".$parseURL["host"];
|
||||
if ($this->acceptEncoding !== "")
|
||||
$this->headersSent[] = "Accept-Encoding: $this->acceptEncoding";
|
||||
if ($this->acceptLanguage !== "")
|
||||
$this->headersSent[] = "Accept-Language: $this->acceptLanguage";
|
||||
if ($this->accept != "")
|
||||
$this->headersSent[] = "Accept: $this->accept";
|
||||
if ($this->useragent !== "")
|
||||
@@ -816,7 +854,7 @@ class Httpclient
|
||||
continue;
|
||||
if ($storedCookie[0] !== $domain || $storedCookie[5] !== $name)
|
||||
continue;
|
||||
if ($expiration < time ())
|
||||
if ($expiration > 0 && $expiration < time ())
|
||||
{
|
||||
//echo "Remove the already set cookie for $domain $name : expired\n";
|
||||
unset ($this->cookies[$key]);
|
||||
|
||||
Reference in New Issue
Block a user