After upgrading to Magento Community 2.2.6 the setup wizard required me to enter my access keys again. Every time I try to add my public and private keys from my Magento Marketplace account the server returns the following error:

Invalid response line returned from server: HTTP/2 200

The actual response from the /setup/index.php/marketplace/save-auth-json call is {"success":false,"message":"Invalid response line returned from server: HTTP/2 200 \r\n"}

Magento 2.2.6 Apache/2.4.37 PHP 7.1

2 Answers 2


There is a problem with HTTP/2 and does not validates SSL when try to connect to marketplace. I found the connections opens and closed immediately before user / pass validation.

A solution for this problem that worked in my case is to change the following code in


at around line number 435

class Curl implements \Magento\Framework\HTTP\ClientInterface

protected function parseHeaders($ch, $data)
if ($this->_headerCount == 0) {
$line = explode(" ", trim($data), 3);
// if (count($line) != 3) {
+ if (count($line) < 2) {
$this->doError("Invalid response line returned from server: " . $data);
$this->_responseStatus = intval($line[1]);

you can override above method as well and then implement above fix.

I hope this will work for you too!!


This is caused by a header verification method within the Magento2 framework that isn't compatible with HTTP/2 shorter headers.

In order to patch this issue one would have to proceed to the following override:




if (count($line) != 3) {
    $this->doError("Invalid response line returned from server: " . $data);


if (count($line) != 3 && strpos($data, "HTTP/2") === false) {
    $this->doError("Invalid response line returned from server: " . $data);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.