-
Notifications
You must be signed in to change notification settings - Fork 14
Description
After upgrading to version 1.8.0, we see a lot of API errors in the Paazl log on our test environments. As a result, the checkout widget does not load, and as a fallback only the Magento shipping methods show in the shipping step of the checkout.
[2021-10-19 06:47:04] Magento2.INFO: Token request: : {"reference":"885939"} [] []
[2021-10-19 06:47:04] Magento2.INFO: exception: API error [] []
When adding some additional logging, I found that the error we see is actually the following:
Invalid response line returned from server: HTTP/2 200
This error is thrown in \Paazl\CheckoutWidget\Model\Api\Http\Client::parseHeaders:
if ($this->_headerCount == 0) {
$line = explode(" ", trim($data), 3);
if (count($line) != 3) {
$this->doError("Invalid response line returned from server: " . $data);
}
$code = intval($line[1]);
Looks like the client expects the status line in the response to consist of 3 parts, separated by spaces. However, in our case, it only consists of 2 parts ("HTTP/2" and "200"). The original method, \Magento\Framework\HTTP\Client\Curl::parseHeaders, does indeed only throw an error if there are less than 2 parts:
if ($this->_headerCount == 0) {
$line = explode(" ", trim($data), 3);
if (count($line) < 2) {
$this->doError("Invalid response line returned from server: " . $data);
}
$this->_responseStatus = (int)$line[1];
Is there any reason for this? If I change the "!= 3" to "< 2" like in Magento's CURL client, the widget works just fine.
Paazl version: 1.8.0
Magento version: 2.4.3