From 57c207603a0d85ecb43c81393f95d62864b4aaf1 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Tue, 6 Jul 2010 18:36:27 +0000 Subject: dont redirect endlessly when require_valid_user=true git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@960975 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd.erl | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/couchdb/couch_httpd.erl') diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index ef930147..079b9367 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -748,15 +748,20 @@ error_headers(#httpd{mochi_req=MochiReq}=Req, Code, ErrorStr, ReasonStr) -> 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, < + {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, <