Q: Unable to synch with Marketplace after upgrade to 2.2.6 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

A: 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  

vendor/magento/framework/HTTP/Client/Curl.php

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!!

A: 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:
Class::Function:

Magento\Framework\HTTP\Client::parseHeaders()

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

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

