You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2019/10/08 16:20:14 UTC

[couchdb] 01/01: Remove "externals"

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch remove-externals
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit cc73e09f25478c681b381d21a84da92c64cf3060
Author: Robert Newson <rn...@apache.org>
AuthorDate: Tue Oct 8 14:57:26 2019 +0100

    Remove "externals"
    
    Remove all the plumbing that enabled `_external/` request handling,
    leaving only the functions necessary for `list` and `show`.
    
    closes https://github.com/apache/couchdb/issues/2166
---
 src/chttpd/src/chttpd_external.erl     | 36 ----------------------------------
 src/couch/src/couch_httpd_external.erl | 34 --------------------------------
 2 files changed, 70 deletions(-)

diff --git a/src/chttpd/src/chttpd_external.erl b/src/chttpd/src/chttpd_external.erl
index fa35c6b..451d87d 100644
--- a/src/chttpd/src/chttpd_external.erl
+++ b/src/chttpd/src/chttpd_external.erl
@@ -14,7 +14,6 @@
 
 -compile(tuple_calls).
 
--export([handle_external_req/2, handle_external_req/3]).
 -export([send_external_response/2]).
 -export([json_req_obj_fields/0, json_req_obj/2, json_req_obj/3, json_req_obj/4]).
 -export([default_or_content_type/2, parse_external_response/1]).
@@ -23,41 +22,6 @@
 
 -include_lib("couch/include/couch_db.hrl").
 
-% handle_external_req/2
-% for the old type of config usage:
-% _external = {chttpd_external, handle_external_req}
-% with urls like
-% /db/_external/action/design/name
-handle_external_req(#httpd{
-                        path_parts=[_DbName, _External, UrlName | _Path]
-                    }=HttpReq, Db) ->
-    process_external_req(HttpReq, Db, UrlName);
-handle_external_req(#httpd{path_parts=[_, _]}=Req, _Db) ->
-    send_error(Req, 404, <<"external_server_error">>, <<"No server name specified.">>);
-handle_external_req(Req, _) ->
-    send_error(Req, 404, <<"external_server_error">>, <<"Broken assumption">>).
-
-% handle_external_req/3
-% for this type of config usage:
-% _action = {chttpd_external, handle_external_req, <<"action">>}
-% with urls like
-% /db/_action/design/name
-handle_external_req(HttpReq, Db, Name) ->
-    process_external_req(HttpReq, Db, Name).
-
-process_external_req(HttpReq, Db, Name) ->
-
-    Response = couch_external_manager:execute(binary_to_list(Name),
-        json_req_obj(HttpReq, Db)),
-
-    case Response of
-    {unknown_external_server, Msg} ->
-        send_error(HttpReq, 404, <<"external_server_error">>, Msg);
-    _ ->
-        send_external_response(HttpReq, Response)
-    end.
-
-
 json_req_obj(Req, Db) ->
     json_req_obj(Req, Db, null).
 json_req_obj(Req, Db, DocId) ->
diff --git a/src/couch/src/couch_httpd_external.erl b/src/couch/src/couch_httpd_external.erl
index 684f900..d4842fb 100644
--- a/src/couch/src/couch_httpd_external.erl
+++ b/src/couch/src/couch_httpd_external.erl
@@ -14,7 +14,6 @@
 
 -compile(tuple_calls).
 
--export([handle_external_req/2, handle_external_req/3]).
 -export([send_external_response/2, json_req_obj/2, json_req_obj/3]).
 -export([default_or_content_type/2, parse_external_response/1]).
 
@@ -22,39 +21,6 @@
 
 -include_lib("couch/include/couch_db.hrl").
 
-% handle_external_req/2
-% for the old type of config usage:
-% _external = {couch_httpd_external, handle_external_req}
-% with urls like
-% /db/_external/action/design/name
-handle_external_req(#httpd{
-                        path_parts=[_DbName, _External, UrlName | _Path]
-                    }=HttpReq, Db) ->
-    process_external_req(HttpReq, Db, UrlName);
-handle_external_req(#httpd{path_parts=[_, _]}=Req, _Db) ->
-    send_error(Req, 404, <<"external_server_error">>, <<"No server name specified.">>);
-handle_external_req(Req, _) ->
-    send_error(Req, 404, <<"external_server_error">>, <<"Broken assumption">>).
-
-% handle_external_req/3
-% for this type of config usage:
-% _action = {couch_httpd_external, handle_external_req, <<"action">>}
-% with urls like
-% /db/_action/design/name
-handle_external_req(HttpReq, Db, Name) ->
-    process_external_req(HttpReq, Db, Name).
-
-process_external_req(HttpReq, Db, Name) ->
-
-    Response = couch_external_manager:execute(binary_to_list(Name),
-        json_req_obj(HttpReq, Db)),
-
-    case Response of
-    {unknown_external_server, Msg} ->
-        send_error(HttpReq, 404, <<"external_server_error">>, Msg);
-    _ ->
-        send_external_response(HttpReq, Response)
-    end.
 json_req_obj(Req, Db) -> json_req_obj(Req, Db, null).
 json_req_obj(#httpd{mochi_req=Req,
                method=Method,