iilyak commented on a change in pull request #3568:
URL: https://github.com/apache/couchdb/pull/3568#discussion_r633781497
##########
File path: src/chttpd/src/chttpd.erl
##########
@@ -1098,59 +1232,84 @@ maybe_handle_error(Error) ->
{500, <<"unknown_error">>, couch_util:to_binary(Error)}
end.
-
-error_headers(#httpd{mochi_req=MochiReq}=Req, 401=Code, ErrorStr, ReasonStr) ->
+error_headers(#httpd{mochi_req = MochiReq} = Req, 401 = Code, ErrorStr,
ReasonStr) ->
% this is where the basic auth popup is triggered
case MochiReq:get_header_value("X-CouchDB-WWW-Authenticate") of
- undefined ->
- case config:get("httpd", "WWW-Authenticate", undefined) of
undefined ->
- % If the client is a browser and the basic auth popup isn't turned
on
- % redirect to the session page.
- case ErrorStr of
- <<"unauthorized">> ->
- case config:get("couch_httpd_auth", "authentication_redirect",
undefined) of
- undefined -> {Code, []};
- AuthRedirect ->
- case config:get("couch_httpd_auth", "require_valid_user",
"false") of
- "true" ->
- % send the browser popup header no matter what if we
are require_valid_user
- {Code, [{"WWW-Authenticate", "Basic
realm=\"server\""}]};
- _False ->
- case MochiReq:accepts_content_type("application/json")
of
- true ->
- {Code, []};
- false ->
- case MochiReq:accepts_content_type("text/html") of
- true ->
- % Redirect to the path the user requested, not
- % the one that is used internally.
- UrlReturnRaw = case
MochiReq:get_header_value("x-couchdb-vhost-path") of
+ case config:get("httpd", "WWW-Authenticate", undefined) of
Review comment:
This function is very wide using new formatting rules. I wounder if
erlfmt is flexible enough to use default indent 2 globally instead of 4.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]