diff --git a/IntelliSenseHelper.php b/IntelliSenseHelper.php new file mode 100644 index 0000000..8b6f094 --- /dev/null +++ b/IntelliSenseHelper.php @@ -0,0 +1,20 @@ +<?php + +/** + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * https://www.d3data.de + * + * @copyright (C) D3 Data Development (Inh. Thomas Dartsch) + * @author D3 Data Development - Daniel Seifert <info@shopmodule.com> + * @link https://www.oxidmodule.com + */ + +namespace D3\SidCookieFix\modules\core { + + use OxidEsales\Eshop\Core\Session; + + class Session_sidcookiefix_parent extends Session {} +} + \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/setup+doku/installation.txt b/README.md similarity index 77% rename from setup+doku/installation.txt rename to README.md index b8543a5..9e12803 100644 --- a/setup+doku/installation.txt +++ b/README.md @@ -1,16 +1,27 @@ +# SID Cookie Fix + Dieses Bugfix verhindert das mehrfache Setzen des Session-ID-Cookies und der damit verbundenden Vergr��erung der Headerzeilen jeder geladenen Ressource. Dies f�hrt bei manchen LoadBalancer-Konfigurationen zu Verbindungsabbr�chen. +## Important + Bitte beachten Sie: Eingriffe in das Session- und Cookie-Handling k�nnen tiefgreifende Auswirkungen auf den Shopbetrieb haben. Wir stellen diese Erweiterung ohne Gew�hrleistung zur Verf�gung. Testen Sie dies vor einem produktiven Einsatz unbedingt umfangreich. Der Einsatz dieses Moduls erfolgt auf eigenes Risiko. -Dieses Modul ist einsetzbar im OXID eShop ab Version 4.3.2 bis 4.10.3 / 5.3.3. Davon +## Requirements + +Dieses Modul ist einsetzbar im OXID eShop ab Version 6.2. Davon abweichende Shopversionen wurden damit nicht kontrolliert. -Kopieren Sie den Inhalt des "copy_this"-Ordners in den Root-Ordner Ihres Shops. +## Installation + +``` +compser require d3/sidcookiefix +``` + Aktivieren Sie das Modul "D3 Session ID Cookie fix" im Adminbereich unter "Erweiterungen -> Module". \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..2c4b029 --- /dev/null +++ b/composer.json @@ -0,0 +1,46 @@ +{ + "name": "d3/sidcookiefix", + "description": "verhindert das mehrfache Setzen des Session-ID-Cookies und der damit verbundenden Vergrößerung der Headerzeilen jeder geladenen Ressource", + "type": "oxideshop-module", + "keywords": [ + "oxid", + "modules", + "eShop", + "d3" + ], + "authors": [ + { + "name": "D3 Data Development (Inh. Thomas Dartsch)", + "email": "info@shopmodule.com", + "homepage": "https://www.d3data.de", + "role": "Owner" + } + ], + "support": { + "email": "support@shopmodule.com" + }, + "homepage": "https://www.oxidmodule.com/", + "license": [ + "GPL-3.0-or-later" + ], + "require": { + "oxid-esales/oxideshop-ce": "^6.5" + }, + "extra": { + "oxideshop": { + "blacklist-filter": [ + "*.md", + "composer.json", + ".php-cs-fixer.php", + "*.xml", + "*.neon" + ], + "target-directory": "d3/sidcookiefix" + } + }, + "autoload": { + "psr-4": { + "D3\\SidCookieFix\\": "../../../source/modules/d3/sidcookiefix" + } + } +} diff --git a/copy_this/modules/d3/sidcookiefix/metadata.php b/copy_this/modules/d3/sidcookiefix/metadata.php deleted file mode 100644 index 7191152..0000000 --- a/copy_this/modules/d3/sidcookiefix/metadata.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -/** - * Metadata version - */ -$sMetadataVersion = '1.1'; - -$sD3Logo = (class_exists(d3\modcfg\Application\Model\d3utils::class) ? d3\modcfg\Application\Model\d3utils::getInstance()->getD3Logo() : 'D³'); - -/** - * Module information - */ -$aModule = array( - 'id' => 'd3sidcookiefix', - 'title' => $sD3Logo . ' Session ID Cookie fix', - 'description' => array( - 'de' => '<ul><li>fix multiple session cookie header lines </li>' - .'<li>causes "Connection reset by peer" errors </li>' - .'<li>error occur in some load balancer configurations because of to long headers</li></ul>', - 'en' => '' - ), - 'thumbnail' => 'picture.png', - 'version' => '2.0.0.0', - 'author' => 'D³ Data Development (Inh.: Thomas Dartsch)', - 'email' => 'support@shopmodule.com', - 'url' => 'http://www.oxidmodule.com/', - 'extend' => array( - OxidEsales\Eshop\Core\Session::class => 'd3/sidcookiefix/modules/core/d3_sidcookiefix_oxsession', - ), - 'files' => array(), - 'templates' => array(), - 'events' => array(), - 'blocks' => array(), - 'settings' => array(), -); diff --git a/copy_this/modules/d3/sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php b/copy_this/modules/d3/sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php deleted file mode 100644 index 5a7ae4b..0000000 --- a/copy_this/modules/d3/sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -/** - * This Software is the property of Data Development and is protected - * by copyright law - it is NOT Freeware. - * - * Any unauthorized use of this software without a valid license - * is a violation of the license agreement and will be prosecuted by - * civil and criminal law. - * - * http://www.shopmodule.com - * - * @copyright � D� Data Development, Thomas Dartsch - * @author D� Data Development - Daniel Seifert <support@shopmodule.com> - * @link http://www.oxidmodule.com - */ - -class d3_sidcookiefix_oxsession extends d3_sidcookiefix_oxsession_parent -{ - protected function _setSessionId($sSessId) - { - //marking this session as new one, as it might be not writen to db yet - if ($sSessId && session_id() != $sSessId) { - $this->_blNewSession = true; - } - - session_id($sSessId); - - $this->setId($sSessId); - - $blUseCookies = $this->_getSessionUseCookies(); - - if (!$this->_allowSessionStart()) { - if ($blUseCookies) { - oxRegistry::get("oxUtilsServer")->setOxCookie($this->getName(), null); - } - - return; - } - - if ($blUseCookies) { - // D3: check for set SessionCookie - $sCookieSessid = oxRegistry::get("oxUtilsServer")->getOxCookie($this->getName()); - if (!$sCookieSessid || $sSessId != $sCookieSessid) { - //setting session cookie - oxRegistry::get("oxUtilsServer")->setOxCookie($this->getName(), $sSessId); - } - } - } -} \ No newline at end of file diff --git a/metadata.php b/metadata.php new file mode 100644 index 0000000..4a2e4c7 --- /dev/null +++ b/metadata.php @@ -0,0 +1,31 @@ +<?php + +use D3\SidCookieFix\modules\core\Session_sidcookiefix; +use OxidEsales\Eshop\Core\Session; + +$sMetadataVersion = '2.1'; + +$logo = '<img src="https://logos.oxidmodule.com/d3logo_individual.svg" alt="(D3)" style="height:1em;width:1em">'; + +$aModule = [ + 'id' => 'd3sidcookiefix', + 'title' => $logo . ' Session ID Cookie fix', + 'description' => [ + 'de' => '<ul><li>fix multiple session cookie header lines </li>' + .'<li>causes "Connection reset by peer" errors </li>' + .'<li>error occur in some load balancer configurations because of to long headers</li></ul>', + 'en' => '' + ], + 'thumbnail' => 'picture.png', + 'version' => '1.0.0.0', + 'author' => 'D³ Data Development (Inh.: Thomas Dartsch)', + 'email' => 'support@shopmodule.com', + 'url' => 'https://www.oxidmodule.com/', + 'extend' => [ + Session::class => Session_sidcookiefix::class, + ], + 'templates' => [], + 'events' => [], + 'blocks' => [], + 'settings' => [], +]; diff --git a/modules/core/Session_sidcookiefix.php b/modules/core/Session_sidcookiefix.php new file mode 100644 index 0000000..24b98e3 --- /dev/null +++ b/modules/core/Session_sidcookiefix.php @@ -0,0 +1,35 @@ +<?php + +/** + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * https://www.d3data.de + * + * @copyright (C) D3 Data Development (Inh. Thomas Dartsch) + * @author D3 Data Development - Daniel Seifert <info@shopmodule.com> + * @link https://www.oxidmodule.com + */ + +declare(strict_types=1); + +namespace D3\SidCookieFix\modules\core; + +use OxidEsales\Eshop\Core\Registry; + +class Session_sidcookiefix extends Session_sidcookiefix_parent +{ + protected function setSessionCookie($sessionId): void + { + if ($this->_getSessionUseCookies()) { + if (!$this->_allowSessionStart()) { + Registry::getUtilsServer()->setOxCookie($this->getName(), null); + } else { + $sCookieSessid = Registry::getUtilsServer()->getOxCookie($this->getName()); + if (!$sCookieSessid || $sessionId != $sCookieSessid) { + Registry::getUtilsServer()->setOxCookie( $this->getName(), $sessionId ); + } + } + } + } +} \ No newline at end of file diff --git a/copy_this/modules/d3/sidcookiefix/picture.png b/picture.png similarity index 100% rename from copy_this/modules/d3/sidcookiefix/picture.png rename to picture.png