Hey,

i just had a discussion with Danimo regarding initialization of Session. When 
the client or any WebDAV client connects for example a session is being 
created on each request, but it is not used for this purpose. All WebDAV 
action work fine without Sessions even in the Shared folder. I assume this will 
be the same for CalDAV and CardDAV. I checked it with the diff as attached. I 
remember session creation was really expensive (is it still so? didn't check), 
so we can get rid of it in cases where we do not need them.

As better solution we could make a Helper method isSessionRequired() (or even 
in Base) that checks the request. Depending on the return value initSession() 
is executed or not.

Cheers
Arthur
diff --git a/lib/base.php b/lib/base.php
index 51f8f4e..bdeca54 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -306,7 +306,6 @@ class OC{
                //try to set the session lifetime to 60min
                @ini_set('gc_maxlifetime', '3600');
 
-
                //set http auth headers for apache+php-cgi work around
                if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches)) {
                        list($name, $password) = explode(':', base64_decode($matches[1]), 2);
@@ -336,9 +335,18 @@ class OC{
                stream_wrapper_register('static', 'OC_StaticStreamWrapper');
                stream_wrapper_register('close', 'OC_CloseStreamWrapper');
 
+               $path_info = OC_Request::getPathInfo();
+               if (!$pos = strpos($path_info, '/', 1)) {
+                       $pos = strlen($path_info);
+               }
+               $service=substr($path_info, 1, $pos-1);
+               $skipSession = $service == 'webdav' ? true : false;
+
                self::checkInstalled();
                self::checkSSL();
-               self::initSession();
+               if(!$skipSession) {
+                       self::initSession();
+               }
                self::initTemplateEngine();
                self::checkUpgrade();
_______________________________________________
Owncloud mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/owncloud

Reply via email to