public function __construct(array $options = array(), BuzzClientInterface $client = null) { $this->client = is_null($client) ? new Curl() : $client; $this->options = array_merge($this->options, $options); $this->client->setTimeout($this->options['timeout']); $this->client->setVerifyPeer($this->options['verify_peer']); }
protected function setUp() { parent::setUp(); $this->httpHost = getenv('EZP_TEST_REST_HOST') ?: 'localhost'; $this->httpAuth = getenv('EZP_TEST_REST_AUTH') ?: 'admin:publish'; $this->httpClient = new \Buzz\Client\Curl(); $this->httpClient->setVerifyPeer(false); $this->httpClient->setTimeout(90); $this->httpClient->setOption(CURLOPT_FOLLOWLOCATION, false); }
protected function setUp() { parent::setUp(); if (!($this->httpHost = getenv('EZP_TEST_REST_HOST'))) { self::markTestSkipped('Set the EZP_TEST_REST_HOST (api.example.com) to your eZ Publish test instance'); } if (!($this->httpAuth = getenv('EZP_TEST_REST_AUTH'))) { self::markTestSkipped('Set the EZP_TEST_REST_AUTH (admin:publish) to your eZ Publish test instance'); } $this->httpClient = new \Buzz\Client\Curl(); $this->httpClient->setVerifyPeer(false); $this->httpClient->setTimeout(90); $this->httpClient->setOption(CURLOPT_FOLLOWLOCATION, false); }
protected function setUp() { parent::setUp(); $this->httpHost = getenv('EZP_TEST_REST_HOST') ?: 'localhost'; $this->httpAuth = getenv('EZP_TEST_REST_AUTH') ?: 'admin:publish'; list($this->loginUsername, $this->loginPassword) = explode(':', $this->httpAuth); $this->httpClient = new \Buzz\Client\Curl(); $this->httpClient->setVerifyPeer(false); $this->httpClient->setTimeout(90); $this->httpClient->setOption(CURLOPT_FOLLOWLOCATION, false); if ($this->autoLogin) { $session = $this->login(); $this->headers[] = sprintf('Cookie: %s=%s', $session->name, $session->identifier); $this->headers[] = sprintf('X-CSRF-Token: %s', $session->csrfToken); } }
/** * @param array $options * @param ClientInterface $client */ public function __construct(array $options = array(), ClientInterface $client = null) { $this->_options = (object) array_merge(array('host' => 'localhost', 'port' => '5984', 'path' => '/', 'ssl' => false, 'proxy' => false, 'timeout' => 5, 'name' => null, 'user' => null, 'pass' => null), $options); $this->_cookies = new CookieJar(); if (empty($client)) { $client = new Curl(); } $this->_client = $client; $this->_client->setTimeout($this->getTimeout()); if ($this->isSSL()) { // $opts[CURLOPT_SSL_VERIFYPEER] = true; // $opts[CURLOPT_SSL_VERIFYHOST] = true; // $opts[CURLOPT_CAINFO] = $this->sslCertPath; } if ($this->hasProxy()) { $this->_client->setProxy($this->getProxy()); } if ($this->hasAuth()) { $this->_auth = (object) array('user' => $this->_options->user, 'pass' => $this->_options->pass); } }
protected function call() { $this->request->setMethod($this->call->getMethod()); $this->request->setHost($this->call->getRequestPartBase()); $this->request->setResource($this->call->getRequestPartUri()); $this->request->setHeaders($this->headers->getHeaders()); if ($this->call->getFormattedBody()) { $this->request->setContent($this->call->getFormattedBody()); } $this->client->setIgnoreErrors(true); $this->client->setVerifyPeer($this->configuration->getVerifyPeer()); $this->client->setMaxRedirects(0); $this->client->setTimeout(60); $this->client->send($this->request, $this->response); }
/** * @param ClientInterface $client */ public function setClient($client) { $this->client = $client; $this->client->setTimeout($this->options['timeout']); $this->client->setVerifyPeer(0); }