From 0f3bdd9ce1b0549707d8a423b2c59e14d3464742 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Tue, 25 Apr 2017 10:18:56 +0200 Subject: [PATCH] add d3SidCookieFix branch --- .../modules/d3/d3sidcookiefix/metadata.php | 36 +++++++++++++ .../core/d3_sidcookiefix_oxsession.php | 50 +++++++++++++++++++ setup+doku/installation.txt | 16 ++++++ 3 files changed, 102 insertions(+) create mode 100644 copy_this/modules/d3/d3sidcookiefix/metadata.php create mode 100644 copy_this/modules/d3/d3sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php create mode 100644 setup+doku/installation.txt diff --git a/copy_this/modules/d3/d3sidcookiefix/metadata.php b/copy_this/modules/d3/d3sidcookiefix/metadata.php new file mode 100644 index 0000000..8d40a2e --- /dev/null +++ b/copy_this/modules/d3/d3sidcookiefix/metadata.php @@ -0,0 +1,36 @@ + 'd3sidcookiefix', + 'title' => + (class_exists('d3utils') ? d3utils::getInstance()->getD3Logo() : 'D³') . + ' Session ID Cookie fix', + 'description' => array( + 'de' => 'fix multiple session cookie header lines - causes "Connection reset by peer" errors in some load balancer configurations because of to long headers', + 'en' => ''), + // 'thumbnail' => 'picture.png', + 'version' => '1.0.0.0', + 'author' => 'D³ Data Development (Inh.: Thomas Dartsch)', + 'email' => 'support@shopmodule.com', + 'url' => 'http://www.oxidmodule.com/', + 'extend' => array( + 'oxsession' => 'd3/d3sidcookiefix/modules/core/d3_sidcookiefix_oxsession', + ), + 'files' => array( + ), + 'templates' => array( + ), + 'events' => array( + ), + 'blocks' => array( + ), + 'settings' => array( + ), +); \ No newline at end of file diff --git a/copy_this/modules/d3/d3sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php b/copy_this/modules/d3/d3sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php new file mode 100644 index 0000000..a49d60f --- /dev/null +++ b/copy_this/modules/d3/d3sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php @@ -0,0 +1,50 @@ + + * @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/setup+doku/installation.txt b/setup+doku/installation.txt new file mode 100644 index 0000000..b8543a5 --- /dev/null +++ b/setup+doku/installation.txt @@ -0,0 +1,16 @@ +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. + +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 +abweichende Shopversionen wurden damit nicht kontrolliert. + +Kopieren Sie den Inhalt des "copy_this"-Ordners in den Root-Ordner Ihres Shops. +Aktivieren Sie das Modul "D3 Session ID Cookie fix" im Adminbereich unter "Erweiterungen -> +Module". \ No newline at end of file