Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions src/chttpd/src/chttpd_external.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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]).
Expand All @@ -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) ->
Expand Down
1 change: 0 additions & 1 deletion src/couch/src/couch.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
{registered, [
couch_db_update,
couch_db_update_notifier_sup,
couch_external_manager,
couch_httpd,
couch_primary_services,
couch_proc_manager,
Expand Down
120 changes: 0 additions & 120 deletions src/couch/src/couch_external_manager.erl

This file was deleted.

90 changes: 0 additions & 90 deletions src/couch/src/couch_external_server.erl

This file was deleted.

34 changes: 0 additions & 34 deletions src/couch/src/couch_httpd_external.erl
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,13 @@

-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]).

-import(couch_httpd,[send_error/4]).

-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,
Expand Down