You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2009/09/24 05:38:00 UTC
svn commit: r818357 - /couchdb/trunk/src/couchdb/couch_httpd_auth.erl
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) -> [].