mirror of
https://github.com/YGGverse/gemini-php.git
synced 2025-03-13 06:01:58 +00:00
add stream context options support
This commit is contained in:
parent
75685f3737
commit
54ad13e9a5
@ -11,6 +11,15 @@ class Request
|
||||
private string $_path;
|
||||
private string $_query;
|
||||
|
||||
private array $_options =
|
||||
[
|
||||
'ssl' =>
|
||||
[
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct(string $url)
|
||||
{
|
||||
if ($host = parse_url($url, PHP_URL_HOST))
|
||||
@ -68,6 +77,16 @@ class Request
|
||||
}
|
||||
}
|
||||
|
||||
public function setOptions(array $value): void
|
||||
{
|
||||
$this->_options = $value;
|
||||
}
|
||||
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->_options;
|
||||
}
|
||||
|
||||
public function setHost(string $value): void
|
||||
{
|
||||
$this->_host = $value;
|
||||
@ -128,13 +147,7 @@ class Request
|
||||
$timeout,
|
||||
STREAM_CLIENT_CONNECT,
|
||||
stream_context_create(
|
||||
[
|
||||
'ssl' =>
|
||||
[
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false
|
||||
]
|
||||
]
|
||||
$this->_options
|
||||
)
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user