You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by jc...@apache.org on 2010/07/06 20:36:27 UTC
svn commit: r960975 - /couchdb/trunk/src/couchdb/couch_httpd.erl
Author: jchris
Date: Tue Jul 6 18:36:27 2010
New Revision: 960975
URL: http://svn.apache.org/viewvc?rev=960975&view=rev
Log:
dont redirect endlessly when require_valid_user=true
Modified:
couchdb/trunk/src/couchdb/couch_httpd.erl
Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=960975&r1=960974&r2=960975&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Tue Jul 6 18:36:27 2010
@@ -748,15 +748,20 @@ error_headers(#httpd{mochi_req=MochiReq}
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 ->
+ case couch_config:get("couch_httpd_auth", "require_valid_user", "false") of
+ "true" ->
{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>>)}]}
+ _False ->
+ % 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
end;
_Else ->