Skip to content

Commit

Permalink
Fixed curl adapter to properly set http version as passed in argument…
Browse files Browse the repository at this point in the history
…s to prevent failure when requesting from http2 capable endpoint
  • Loading branch information
davidalger committed Mar 1, 2019
1 parent 1514eeb commit b57dab0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/internal/Magento/Framework/HTTP/Adapter/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = '
curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'GET');
}

if ($http_ver === \Zend_Http_Client::HTTP_1) {
curl_setopt($this->_getResource(), CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
} elseif ($http_ver === \Zend_Http_Client::HTTP_0) {
curl_setopt($this->_getResource(), CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
}

if (is_array($headers)) {
curl_setopt($this->_getResource(), CURLOPT_HTTPHEADER, $headers);
}
Expand Down

0 comments on commit b57dab0

Please sign in to comment.