[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2841] branches/1.2/LedgerSMB/Session/DB.pm



Revision: 2841
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2841&view=rev
Author:   einhverfr
Date:     2010-01-22 21:43:28 +0000 (Fri, 22 Jan 2010)

Log Message:
-----------
Setting secure flag on cookie where appropriate

Modified Paths:
--------------
    branches/1.2/LedgerSMB/Session/DB.pm

Modified: branches/1.2/LedgerSMB/Session/DB.pm
===================================================================
--- branches/1.2/LedgerSMB/Session/DB.pm	2010-01-22 20:26:09 UTC (rev 2840)
+++ branches/1.2/LedgerSMB/Session/DB.pm	2010-01-22 21:43:28 UTC (rev 2841)
@@ -103,7 +103,10 @@
               $sessionID . ':' . $newTransactionID . ':' . $token;
 
             #now update the cookie in the browser
-            print qq|Set-Cookie: LedgerSMB=$newCookieValue; path=/;\n|;
+            if ($ENV{SERVER_PORT} == 443){
+                $secure = ' Secure;';
+            }
+            print qq|Set-Cookie: LedgerSMB=$newCookieValue; path=/;$secure\n|;
             return 1;
 
         }
@@ -202,7 +205,11 @@
 
     #now set the cookie in the browser
     #TODO set domain from ENV, also set path to install path
-    print qq|Set-Cookie: LedgerSMB=$newCookieValue; path=/;\n|;
+    my $secure = '';
+    if ($ENV{SERVER_PORT} == 443){
+        $secure = ' Secure;';
+    }
+    print qq|Set-Cookie: LedgerSMB=$newCookieValue; path=/;$secure\n|;
     $form->{LedgerSMB} = $newCookieValue;
 }
 
@@ -226,7 +233,11 @@
         __FILE__ . ':' . __LINE__ . ': Delete from session: ' );
 
     #delete the cookie in the browser
-    print qq|Set-Cookie: LedgerSMB=; path=/;\n|;
+    my $secure = '';
+    if ($ENV{SERVER_PORT} == 443){
+        $secure = ' Secure;';
+    }
+    print qq|Set-Cookie: LedgerSMB=; path=/;$secure\n|;
 
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.