Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] Fixed curl adapter to properly set http version based on $http_ver argument #21550

Conversation

davidalger
Copy link
Member

@davidalger davidalger commented Mar 1, 2019

Original Pull Request

#21549

Description (*)

The curl HTTP adapter currently does not respect the value of the $http_ver argument to the write method causing \Magento\Framework\HTTP\ZendClient to throw an exception causing a fatal error when making a request to an HTTP/2 capable server from a client server that has HTTP/2 curl libraries loaded.

Fatal error: Uncaught Zend_Http_Exception: Invalid header line detected in /Volumes/Server/sites/vaporbeast.vbst/vendor/magento/zendframework1/library/Zend/Http/Response.php on line 572

Fixed Issues (if relevant)

  1. Curl - allow setting HTTP version #19845 (this was attempting to fix same thing, but was reverted in commit 55b8bf8 because it was done incorrectly)
  2. [Backport] Curl - allow setting HTTP version #21251 (backport of Curl - allow setting HTTP version #19845; should not be merged due to issues with original PR)

Manual testing scenarios (*)

Use \Magento\Framework\HTTP\ZendClient to make a request to an HTTP/2 capable endpoint from a system with HTTP/2 enabled curl libraries. Without this change in place, the client will fail to parse the response headers because the regex found in \Zend_Http_Response::extractHeaders is specifically expecting HTTP 1.1 or HTTP 1.0 in the response.

To reproduce the issue, the following code snippet may be used:

$client = new \Magento\Framework\HTTP\ZendClient();
$client->setUri('https://davidalger.com/robots.txt');
$result = $client->request();
var_dump($result->getHeaders());

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

…s to prevent failure when requesting from http2 capable endpoint
@magento-engcom-team
Copy link
Contributor

Hi @davidalger. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.2-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team magento-engcom-team added the partners-contribution Pull Request is created by Magento Partner label May 3, 2019
@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-5032 has been created to process this Pull Request

@m2-assistant
Copy link

m2-assistant bot commented May 7, 2019

Hi @davidalger, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

magento-engcom-team pushed a commit that referenced this pull request May 7, 2019
@magento-engcom-team magento-engcom-team added this to the Release: 2.2.10 milestone May 7, 2019
@davidalger davidalger deleted the bugfix/curl-adapater-ignores-http-version-22-backport branch March 30, 2020 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants