Skip to content

Commit

Permalink
Enable HTTP/2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-stripe committed Jul 9, 2018
1 parent b325b5c commit 719f391
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/HttpClient/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
}
// @codingStandardsIgnoreEnd

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

class CurlClient implements ClientInterface
{
private static $instance;
Expand Down Expand Up @@ -193,6 +197,9 @@ public function request($method, $absUrl, $headers, $params, $hasFile)
$opts[CURLOPT_SSL_VERIFYPEER] = false;
}

// Enable HTTP/2, if supported
$opts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;

list($rbody, $rcode) = $this->executeRequestWithRetries($opts, $absUrl);

return [$rbody, $rcode, $rheaders];
Expand Down

0 comments on commit 719f391

Please sign in to comment.