mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
v1.2.5.406
This commit is contained in:
parent
03602d0c0f
commit
04430868b1
431 changed files with 64715 additions and 0 deletions
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace Buzz\Client;
|
||||
|
||||
use Buzz\Message\RequestInterface;
|
||||
|
||||
abstract class AbstractStream extends AbstractClient
|
||||
{
|
||||
/**
|
||||
* Converts a request into an array for stream_context_create().
|
||||
*
|
||||
* @param RequestInterface $request A request object
|
||||
*
|
||||
* @return array An array for stream_context_create()
|
||||
*/
|
||||
public function getStreamContextArray(RequestInterface $request)
|
||||
{
|
||||
$options = array(
|
||||
'http' => array(
|
||||
// values from the request
|
||||
'method' => $request->getMethod(),
|
||||
'header' => implode("\r\n", $request->getHeaders()),
|
||||
'content' => $request->getContent(),
|
||||
'protocol_version' => $request->getProtocolVersion(),
|
||||
|
||||
// values from the current client
|
||||
'ignore_errors' => $this->getIgnoreErrors(),
|
||||
'max_redirects' => $this->getMaxRedirects(),
|
||||
'timeout' => $this->getTimeout(),
|
||||
),
|
||||
'ssl' => array(
|
||||
'verify_peer' => $this->getVerifyPeer(),
|
||||
),
|
||||
);
|
||||
|
||||
if ($this->proxy) {
|
||||
$options['http']['proxy'] = $this->proxy;
|
||||
$options['http']['request_fulluri'] = true;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue