couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iil...@apache.org
Subject [17/50] couch-httpd commit: updated refs/heads/split_out_httpd_stack to e44a372
Date Tue, 01 Mar 2016 20:00:50 GMT
Remove no longer needed function from original


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/commit/680639ee
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/tree/680639ee
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/diff/680639ee

Branch: refs/heads/split_out_httpd_stack
Commit: 680639ee34dc7232992822e8a2a0727f791144f3
Parents: d38f6e9
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Fri Feb 26 10:11:51 2016 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Tue Mar 1 08:35:08 2016 -0800

----------------------------------------------------------------------
 src/couch_httpd_original.erl | 59 ---------------------------------------
 1 file changed, 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/680639ee/src/couch_httpd_original.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_original.erl b/src/couch_httpd_original.erl
index 877b963..f0a9dbf 100644
--- a/src/couch_httpd_original.erl
+++ b/src/couch_httpd_original.erl
@@ -416,65 +416,6 @@ increment_method_stats(Method) ->
 
 % Utilities
 
-
-error_headers(#httpd{mochi_req=MochiReq}=Req, Code, ErrorStr, ReasonStr) ->
-    if Code == 401 ->
-        % 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
-                                    undefined ->
-                                        MochiReq:get(path);
-                                    VHostPath ->
-                                        VHostPath
-                                    end,
-                                    RedirectLocation = lists:flatten([
-                                        AuthRedirect,
-                                        "?return=", couch_util:url_encode(UrlReturnRaw),
-                                        "&reason=", couch_util:url_encode(ReasonStr)
-                                    ]),
-                                    {302, [{"Location", absolute_uri(Req, RedirectLocation)}]};
-                                false ->
-                                    {Code, []}
-                                end
-                            end
-                        end
-                    end;
-                _Else ->
-                    {Code, []}
-                end;
-            Type ->
-                {Code, [{"WWW-Authenticate", Type}]}
-            end;
-        Type ->
-           {Code, [{"WWW-Authenticate", Type}]}
-        end;
-    true ->
-        {Code, []}
-    end.
-
 send_chunked_error(Resp, Error) ->
     {Code, ErrorStr, ReasonStr} = error_info(Error),
     JsonError = {[{<<"code">>, Code},


Mime
View raw message