Skip to content

Commit

Permalink
Add defining CURL constants if they don't exist
Browse files Browse the repository at this point in the history
- CURLPIPE_MULTIPLEX
- CURL_HTTP_VERSION_2
  • Loading branch information
edamov committed Apr 8, 2017
1 parent 636861c commit 44e71da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public function push(): array
{
$mh = curl_multi_init();

if (!defined('CURLPIPE_MULTIPLEX')) {
define('CURLPIPE_MULTIPLEX', 2);
}

curl_multi_setopt($mh, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);

$handles = [];
Expand Down
4 changes: 4 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function __construct(Notification $notification, $isProductionEnv)
$this->uri = $isProductionEnv ? $this->getProductionUrl($notification) : $this->getSandboxUrl($notification);
$this->body = $notification->getPayload()->toJson();

if (!defined('CURL_HTTP_VERSION_2')) {
define('CURL_HTTP_VERSION_2', 3);
}

$this->options = [
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2,
CURLOPT_URL => $this->uri,
Expand Down

0 comments on commit 44e71da

Please sign in to comment.