httpclient : allow ssloptions to be set before connecting

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5317 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-06-06 07:27:36 +00:00
parent a0a5e70fc4
commit 8d8f1a4de0

View File

@@ -442,6 +442,20 @@ class Httpclient
}
// }}}
/** Get/Set the ssl options
* @param array|null $ssloptions The SSL Options to use
* @return $this
*/
public function ssloptions ($ssloptions = null)
// {{{
{
if ($ssloptions === null)
return $this->ssloptions;
$this->ssloptions = $ssloptions;
return $this;
}
// }}}
//////////////////////////////////
//// THE ACTIVE METHODS ////
//////////////////////////////////
@@ -457,7 +471,7 @@ class Httpclient
* @param array|null $ssloptions The SSL options (stream_context_set_option)
* @return the page body
*/
public function getPage ($url, $ssloptions = array ())
public function getPage ($url, $ssloptions = null)
// {{{
{
$this->method ("GET");
@@ -472,11 +486,12 @@ class Httpclient
* @param array|null $ssloptions The SSL options (stream_context_set_option)
* @return $this
*/
public function connect ($ssloptions = array ())
public function connect ($ssloptions = null)
// {{{
{
$this->log (2, "## URL Start $this->method $this->url");
$this->ssloptions = $ssloptions;
if ($ssloptions !== null)
$this->ssloptions = $ssloptions;
$this->headersReceived = array ();
$this->bodySize = null;
$this->httpCode = null;