couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r957805 - in /couchdb/trunk: etc/couchdb/default.ini.tpl.in src/couchdb/couch_httpd.erl src/couchdb/couch_rep_writer.erl
Date Fri, 25 Jun 2010 05:30:51 GMT
Author: jchris
Date: Fri Jun 25 05:30:51 2010
New Revision: 957805

URL: http://svn.apache.org/viewvc?rev=957805&view=rev
Log:
make the authentication redirect URL configurable. setting it to the empty string yields the
0.11 behavior

Modified:
    couchdb/trunk/etc/couchdb/default.ini.tpl.in
    couchdb/trunk/src/couchdb/couch_httpd.erl
    couchdb/trunk/src/couchdb/couch_rep_writer.erl

Modified: couchdb/trunk/etc/couchdb/default.ini.tpl.in
URL: http://svn.apache.org/viewvc/couchdb/trunk/etc/couchdb/default.ini.tpl.in?rev=957805&r1=957804&r2=957805&view=diff
==============================================================================
--- couchdb/trunk/etc/couchdb/default.ini.tpl.in (original)
+++ couchdb/trunk/etc/couchdb/default.ini.tpl.in Fri Jun 25 05:30:51 2010
@@ -29,6 +29,7 @@ include_sasl = true
 
 [couch_httpd_auth]
 authentication_db = _users
+authentication_redirect = /_utils/session.html
 require_valid_user = false
 timeout = 600 ; number of seconds before automatic logout
 auth_cache_size = 50 ; size is number of cache entries

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=957805&r1=957804&r2=957805&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Fri Jun 25 05:30:51 2010
@@ -745,14 +745,19 @@ error_headers(#httpd{mochi_req=MochiReq}
                 % redirect to the session page.
                 case ErrorStr of
                 <<"unauthorized">> ->
-                    % if the accept header matches html, then do the redirect. else proceed
as usual.
-                    case re:run(MochiReq:get_header_value("Accept"), "html", [{capture, none}])
of
-                    nomatch ->
-                        {Code, []};
-                    match ->
-                        UrlReturn = ?l2b(couch_util:url_encode(MochiReq:get(path))),
-                        UrlReason = ?l2b(couch_util:url_encode(ReasonStr)),
-                        {302, [{"Location", couch_httpd:absolute_uri(Req, <<"/_utils/session.html?return=",UrlReturn/binary,"&reason=",UrlReason/binary>>)}]}
+                    case couch_config:get("couch_httpd_auth", "authentication_redirect",
nil) of
+                    nil -> {Code, []};
+                    AuthRedirect ->
+                        % if the accept header matches html, then do the redirect. else proceed
as usual.
+                        case re:run(MochiReq:get_header_value("Accept"), "html", [{capture,
none}]) of
+                        nomatch ->
+                            {Code, []};
+                        match ->
+                            AuthRedirectBin = ?l2b(AuthRedirect),
+                            UrlReturn = ?l2b(couch_util:url_encode(MochiReq:get(path))),
+                            UrlReason = ?l2b(couch_util:url_encode(ReasonStr)),
+                            {302, [{"Location", couch_httpd:absolute_uri(Req, <<AuthRedirectBin/binary,"?return=",UrlReturn/binary,"&reason=",UrlReason/binary>>)}]}
+                        end
                     end;
                 _Else ->
                     {Code, []}

Modified: couchdb/trunk/src/couchdb/couch_rep_writer.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_writer.erl?rev=957805&r1=957804&r2=957805&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_writer.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_writer.erl Fri Jun 25 05:30:51 2010
@@ -78,7 +78,6 @@ write_bulk_docs(#http_db{headers = Heade
         body = {[{new_edits, false}, {docs, JsonDocs}]},
         headers = couch_util:proplist_apply_field({"Content-Type", "application/json"}, [{"X-Couch-Full-Commit",
"false"} | Headers])
     },
-    ?LOG_ERROR("headers ~p",[Request#http_db.headers]),
     ErrorsJson = case couch_rep_httpc:request(Request) of
     {FailProps} ->
         exit({target_error, couch_util:get_value(<<"error">>, FailProps)});



Mime
View raw message