Invalid response line returned from server: HTTP/2 200
I get the above error message when I want to log in to the extension manager.
Does anyone know how I can solve this?
Love to hear if someone has a solution for this.
Invalid response line returned from server: HTTP/2 200
I get the above error message when I want to log in to the extension manager.
Does anyone know how I can solve this?
Love to hear if someone has a solution for this.
I got this answer from stackchange from Asim.
A solution that worked for me is to replace the following code at
lib/internal/Magento/Framework/HTTP/Client/Curl.php or vendor/magento/framework/HTTP/Client/Curl.php
Add Following changes in this function : protected function parseHeaders($ch, $data)
if ($this->_headerCount == 0) {
$line = explode(" ", trim($data), 3);
/* Remove this line */
//if (count($line) != 3) {
/* Add this line */
if (count($line) < 2) {
$this->doError("Invalid response line returned from server: " . $data);
}
$this->_responseStatus = intval($line[1]);
As alternative, you can update regexp in both places:
line 185: replace
if (! preg_match('|^\d\.\d$|', $version)) {
with
if (! preg_match('|^\d(\.\d)?$|', $version)) {
line 517: replace
if ($index === 0 && preg_match('#^HTTP/\d+(?:\.\d+) [1-5]\d+#', $line)) {
with
if ($index === 0 && preg_match('#^HTTP/\d+(?:\.\d+|) [1-5]\d+#', $line)) {
This should work for both HTTP/1.1 and HTTP/2 response headers
I had the same problem and the solution on this page https://community.magento.com/t5/Magento-2-x-Version-Upgrades/Sign-in-to-Magento-Marketplace-gt-quot-Invalid-response-line/td-p/111720 worked for me.
A solution that worked for me is to replace the following code at:
lib/internal/Magento/Framework/HTTP/Client/Curl.php or vendor/magento/framework/HTTP/Client/Curl.php
Add Following changes in this function :
protected function parseHeaders($ch, $data)
if ($this->_headerCount == 0) {
$line = explode(" ", trim($data), 3);
/* Remove this line */
//if (count($line) != 3) {
/* Add this line */
if (count($line) < 2) {
$this->doError("Invalid response line returned from server: " .
$data);
}
$this->_responseStatus = intval($line[1]);
I face with same issue but with stripe module. I suggest you to go vendor/magento/zendframework1/library/Zend/Http/Response.php on line 517 and add
if ($index === 0 && preg_match('#^HTTP/2 200#', $line)) {
// Status line; ignore
continue;
}
and on line 184 comment
// Set the HTTP version
// if (! preg_match('|^\d\.\d$|', $version)) {
// #require_once 'Zend/Http/Exception.php';
// throw new Zend_Http_Exception("Invalid HTTP response version: $version");
// }
Note. It's a hot fix. I hope it help you.