couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject svn commit: r818357 - /couchdb/trunk/src/couchdb/couch_httpd_auth.erl
Date Thu, 24 Sep 2009 03:38:00 GMT
Author: kocolosk
Date: Thu Sep 24 03:37:59 2009
New Revision: 818357

URL: http://svn.apache.org/viewvc?rev=818357&view=rev
Log:
update the AuthSession cookie even if no Set-Cookie is already present

Modified:
    couchdb/trunk/src/couchdb/couch_httpd_auth.erl

Modified: couchdb/trunk/src/couchdb/couch_httpd_auth.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_auth.erl?rev=818357&r1=818356&r2=818357&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_auth.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_auth.erl Thu Sep 24 03:37:59 2009
@@ -259,17 +259,15 @@
     %    or logout handler.
     % The login and logout handlers need to set the AuthSession cookie
     % themselves.
-    case proplists:get_value("Set-Cookie", Headers) of
-    undefined -> [];
-    Cookie -> 
-        case proplists:get_value("AuthSession",
-            mochiweb_cookies:parse_cookie(Cookie), undefined) of
-        undefined ->
-            {NowMS, NowS, _} = erlang:now(),
-            TimeStamp = NowMS * 1000000 + NowS,
-            [cookie_auth_cookie(?b2l(User), Secret, TimeStamp)];
-        _Else -> []
-        end
+    CookieHeader = proplists:get_value("Set-Cookie", Headers, ""),
+    Cookies = mochiweb_cookies:parse_cookie(CookieHeader),
+    AuthSession = proplists:get_value("AuthSession", Cookies),
+    if AuthSession == undefined ->
+        {NowMS, NowS, _} = erlang:now(),
+        TimeStamp = NowMS * 1000000 + NowS,
+        [cookie_auth_cookie(?b2l(User), Secret, TimeStamp)];
+    true ->
+        []
     end;
 cookie_auth_header(_Req, _Headers) -> [].
 



Mime
View raw message