Skip to content

Commit

Permalink
Merge pull request #78 from Paazl/1.9.1
Browse files Browse the repository at this point in the history
1.9.1
  • Loading branch information
Marvin-Magmodules authored Oct 19, 2021
2 parents dcd4dc3 + 6c97bbc commit d75ca6e
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Model/Api/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ 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);
}
$code = intval($line[1]);
if (!HttpCode::execute($code)) {
$this->doError("Invalid response line returned from server: " . $data);
}
if ($code === 100) {
// Handle status 100 Continue
$this->skipNextHeader = true;
Expand Down
68 changes: 68 additions & 0 deletions Model/Api/Http/HttpCode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Paazl\CheckoutWidget\Model\Api\Http;

/**
* HttpCode class
*
* Http Code description
*/
class HttpCode
{

/**
* @param int $code
*
* @return string|bool
*/
public static function execute(int $code)
{
switch ($code) {
case 100: return 'Continue'; break;
case 101: return 'Switching Protocols'; break;
case 200: return 'OK'; break;
case 201: return 'Created'; break;
case 202: return 'Accepted'; break;
case 203: return 'Non-Authoritative Information'; break;
case 204: return 'No Content'; break;
case 205: return 'Reset Content'; break;
case 206: return 'Partial Content'; break;
case 300: return 'Multiple Choices'; break;
case 301: return 'Moved Permanently'; break;
case 302: return 'Moved Temporarily'; break;
case 303: return 'See Other'; break;
case 304: return 'Not Modified'; break;
case 305: return 'Use Proxy'; break;
case 400: return 'Bad Request'; break;
case 401: return 'Unauthorized'; break;
case 402: return 'Payment Required'; break;
case 403: return 'Forbidden'; break;
case 404: return 'Not Found'; break;
case 405: return 'Method Not Allowed'; break;
case 406: return 'Not Acceptable'; break;
case 407: return 'Proxy Authentication Required'; break;
case 408: return 'Request Time-out'; break;
case 409: return 'Conflict'; break;
case 410: return 'Gone'; break;
case 411: return 'Length Required'; break;
case 412: return 'Precondition Failed'; break;
case 413: return 'Request Entity Too Large'; break;
case 414: return 'Request-URI Too Large'; break;
case 415: return 'Unsupported Media Type'; break;
case 500: return 'Internal Server Error'; break;
case 501: return 'Not Implemented'; break;
case 502: return 'Bad Gateway'; break;
case 503: return 'Service Unavailable'; break;
case 504: return 'Gateway Time-out'; break;
case 505: return 'HTTP Version not supported'; break;
default:
return false;
break;
}
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "paazl/magento2-checkout-widget",
"description": "Paazl checkoutWidget for Magento 2",
"type": "magento2-module",
"version": "1.9.0",
"version": "1.9.1",
"keywords": [
"Paazl",
"Magento 2",
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<default>
<carriers>
<paazlshipping>
<version>v1.9.0</version>
<version>v1.9.1</version>
<active>0</active>
<sallowspecific>0</sallowspecific>
<price>0</price>
Expand Down

0 comments on commit d75ca6e

Please sign in to comment.