You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2015/07/21 22:50:35 UTC
[1/6] chttpd commit: updated refs/heads/add-manual-migration-logic to
df0da70
Repository: couchdb-chttpd
Updated Branches:
refs/heads/add-manual-migration-logic 73d6f3302 -> df0da709d (forced update)
Account for binary keys for headers in CORS
We do have headers' keys represented as either lists or binaries.
Make sure we don't crash on `string:to_lower`.
COUCHDB-2733
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/9ddbd040
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/9ddbd040
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/9ddbd040
Branch: refs/heads/add-manual-migration-logic
Commit: 9ddbd04045a833262ff850d63a4e6d6632caea43
Parents: e7f9ed8
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Mon Jun 29 05:45:37 2015 -0700
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Mon Jun 29 09:08:07 2015 -0700
----------------------------------------------------------------------
src/chttpd_cors.erl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/9ddbd040/src/chttpd_cors.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_cors.erl b/src/chttpd_cors.erl
index b109b45..cedb86e 100644
--- a/src/chttpd_cors.erl
+++ b/src/chttpd_cors.erl
@@ -217,9 +217,13 @@ maybe_apply_headers(CorsHeaders, RequestHeaders) ->
simple_headers(Headers) ->
- LCHeaders = [string:to_lower(H) || H <- Headers],
+ LCHeaders = [to_lower(H) || H <- Headers],
lists:filter(fun(H) -> lists:member(H, ?SIMPLE_HEADERS) end, LCHeaders).
+to_lower(String) when is_binary(String) ->
+ to_lower(?b2l(String));
+to_lower(String) ->
+ string:to_lower(String).
handle_headers(_Config, _Origin, []) ->
[];
[4/6] chttpd commit: updated refs/heads/add-manual-migration-logic to
df0da70
Posted by ch...@apache.org.
Dynamic http endpoint handlers
Use `couch_epi` to implement dynamic http endpoint handlers.
The application which wishes to add dynamic endpoint would
have to do following:
1. Add a child into application supervisor
chttpd_handler:provider(myapp, myapp_httpd_handlers)
2. Provide `myapp_httpd_handlers` callback module
-module(myapp_httpd_handlers).
-export([url_handler/1, db_handler/1, design_handler/1]).
url_handler(<<"_foo">>) -> fun myapp_httpd:handle_foo_req/1;
url_handler(_) -> no_match.
db_handler(<<"_bar">>) -> fun myapp_httpd:handle_bar_req/2;
db_handler(_) -> no_match.
design_handler(_) -> no_match.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/ecf745eb
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/ecf745eb
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/ecf745eb
Branch: refs/heads/add-manual-migration-logic
Commit: ecf745eb9c330c84f1a4d7ba9f83ca65622841d4
Parents: 6697f3f
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Wed Jul 15 08:15:45 2015 -0700
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Fri Jul 17 11:02:46 2015 -0700
----------------------------------------------------------------------
src/chttpd.erl | 50 ++++---------------------------
src/chttpd_db.erl | 11 +++----
src/chttpd_handlers.erl | 60 ++++++++++++++++++++++++++++++++++++++
src/chttpd_httpd_handlers.erl | 43 +++++++++++++++++++++++++++
src/chttpd_sup.erl | 1 +
5 files changed, 113 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/ecf745eb/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index f6ce530..2ad237e 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -144,7 +144,8 @@ handle_request(MochiReq0) ->
% removed, but URL quoting left intact
RawUri = MochiReq:get(raw_path),
{"/" ++ Path, _, _} = mochiweb_util:urlsplit_path(RawUri),
- {HandlerKey, _, _} = mochiweb_util:partition(Path, "/"),
+ {HandlerKeyStr, _, _} = mochiweb_util:partition(Path, "/"),
+ HandlerKey = ?l2b(HandlerKeyStr),
Peer = MochiReq:get(peer),
LogForClosedSocket = io_lib:format("mochiweb_recv_error for ~s - ~p ~s", [
@@ -190,9 +191,7 @@ handle_request(MochiReq0) ->
mochi_req = MochiReq,
method = Method,
path_parts = [list_to_binary(chttpd:unquote(Part))
- || Part <- string:tokens(Path, "/")],
- db_url_handlers = db_url_handlers(),
- design_url_handlers = design_url_handlers()
+ || Part <- string:tokens(Path, "/")]
},
% put small token on heap to keep requests synced to backend calls
@@ -208,7 +207,8 @@ handle_request(MochiReq0) ->
not_preflight ->
case authenticate_request(HttpReq, AuthenticationFuns) of
#httpd{} = Req ->
- HandlerFun = url_handler(HandlerKey),
+ HandlerFun = chttpd_handlers:url_handler(
+ HandlerKey, fun chttpd_db:handle_request/1),
HandlerFun(chttpd_auth_request:authorize_request(possibly_hack(Req)));
Response ->
Response
@@ -363,46 +363,6 @@ authenticate_request(Response, _AuthFuns) ->
increment_method_stats(Method) ->
couch_stats:increment_counter([couchdb, httpd_request_methods, Method]).
-url_handler("") -> fun chttpd_misc:handle_welcome_req/1;
-url_handler("favicon.ico") -> fun chttpd_misc:handle_favicon_req/1;
-url_handler("_utils") -> fun chttpd_misc:handle_utils_dir_req/1;
-url_handler("_all_dbs") -> fun chttpd_misc:handle_all_dbs_req/1;
-url_handler("_active_tasks") -> fun chttpd_misc:handle_task_status_req/1;
-url_handler("_node") -> fun chttpd_misc:handle_node_req/1;
-url_handler("_reload_query_servers") -> fun chttpd_misc:handle_reload_query_servers_req/1;
-url_handler("_replicate") -> fun chttpd_misc:handle_replicate_req/1;
-url_handler("_uuids") -> fun chttpd_misc:handle_uuids_req/1;
-url_handler("_session") -> fun chttpd_auth:handle_session_req/1;
-url_handler("_oauth") -> fun couch_httpd_oauth:handle_oauth_req/1;
-url_handler("_up") -> fun chttpd_misc:handle_up_req/1;
-url_handler("_membership") -> fun mem3_httpd:handle_membership_req/1;
-url_handler("_db_updates") -> fun global_changes_httpd:handle_global_changes_req/1;
-url_handler("_cluster_setup") -> fun setup_httpd:handle_setup_req/1;
-url_handler(_) -> fun chttpd_db:handle_request/1.
-
-db_url_handlers() ->
- [
- {<<"_view_cleanup">>, fun chttpd_db:handle_view_cleanup_req/2},
- {<<"_compact">>, fun chttpd_db:handle_compact_req/2},
- {<<"_design">>, fun chttpd_db:handle_design_req/2},
- {<<"_temp_view">>, fun chttpd_view:handle_temp_view_req/2},
- {<<"_changes">>, fun chttpd_db:handle_changes_req/2},
- {<<"_shards">>, fun mem3_httpd:handle_shards_req/2},
- {<<"_index">>, fun mango_httpd:handle_req/2},
- {<<"_explain">>, fun mango_httpd:handle_req/2},
- {<<"_find">>, fun mango_httpd:handle_req/2}
- ].
-
-design_url_handlers() ->
- [
- {<<"_view">>, fun chttpd_view:handle_view_req/3},
- {<<"_show">>, fun chttpd_show:handle_doc_show_req/3},
- {<<"_list">>, fun chttpd_show:handle_view_list_req/3},
- {<<"_update">>, fun chttpd_show:handle_doc_update_req/3},
- {<<"_info">>, fun chttpd_db:handle_design_info_req/3},
- {<<"_rewrite">>, fun chttpd_rewrite:handle_rewrite_req/3}
- ].
-
% Utilities
partition(Path) ->
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/ecf745eb/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index c54340c..207bc3f 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -40,8 +40,7 @@
orelse T == <<"_design_docs">>)).
% Database request handlers
-handle_request(#httpd{path_parts=[DbName|RestParts],method=Method,
- db_url_handlers=DbUrlHandlers}=Req)->
+handle_request(#httpd{path_parts=[DbName|RestParts],method=Method}=Req)->
case {Method, RestParts} of
{'PUT', []} ->
create_db_req(Req, DbName);
@@ -57,7 +56,7 @@ handle_request(#httpd{path_parts=[DbName|RestParts],method=Method,
{_, []} ->
do_db_req(Req, fun db_req/2);
{_, [SecondPart|_]} ->
- Handler = couch_util:get_value(SecondPart, DbUrlHandlers, fun db_req/2),
+ Handler = chttpd_handlers:db_handler(SecondPart, fun db_req/2),
do_db_req(Req, Handler)
end.
@@ -201,14 +200,12 @@ handle_view_cleanup_req(Req, Db) ->
send_json(Req, 202, {[{ok, true}]}).
handle_design_req(#httpd{
- path_parts=[_DbName, _Design, Name, <<"_",_/binary>> = Action | _Rest],
- design_url_handlers = DesignUrlHandlers
+ path_parts=[_DbName, _Design, Name, <<"_",_/binary>> = Action | _Rest]
}=Req, Db) ->
DbName = mem3:dbname(Db#db.name),
case ddoc_cache:open(DbName, <<"_design/", Name/binary>>) of
{ok, DDoc} ->
- Handler = couch_util:get_value(Action, DesignUrlHandlers,
- fun bad_action_req/3),
+ Handler = chttpd_handlers:design_handler(Action, fun bad_action_req/3),
Handler(Req, Db, DDoc);
Error ->
throw(Error)
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/ecf745eb/src/chttpd_handlers.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_handlers.erl b/src/chttpd_handlers.erl
new file mode 100644
index 0000000..65f8b26
--- /dev/null
+++ b/src/chttpd_handlers.erl
@@ -0,0 +1,60 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(chttpd_handlers).
+
+-export([
+ provider/2,
+ url_handler/2,
+ db_handler/2,
+ design_handler/2
+]).
+
+-include_lib("couch/include/couch_db.hrl").
+
+%% ------------------------------------------------------------------
+%% API Function Definitions
+%% ------------------------------------------------------------------
+
+provider(App, Module) ->
+ couch_epi_functions:childspec(chttpd_handlers_subscription,
+ App, chttpd_handlers, Module).
+
+url_handler(HandlerKey, DefaultFun) ->
+ case collect(url_handler, [HandlerKey]) of
+ [HandlerFun] -> HandlerFun;
+ [] -> DefaultFun
+ end.
+
+db_handler(HandlerKey, DefaultFun) ->
+ case collect(db_handler, [HandlerKey]) of
+ [HandlerFun] -> HandlerFun;
+ [] -> DefaultFun
+ end.
+
+design_handler(HandlerKey, DefaultFun) ->
+ case collect(design_handler, [HandlerKey]) of
+ [HandlerFun] -> HandlerFun;
+ [] -> DefaultFun
+ end.
+
+%% ------------------------------------------------------------------
+%% Internal Function Definitions
+%% ------------------------------------------------------------------
+
+collect(Func, Args) ->
+ Results = do_apply(Func, Args, [ignore_providers]),
+ [HandlerFun || HandlerFun <- Results, HandlerFun /= no_match].
+
+do_apply(Func, Args, Opts) ->
+ Handle = couch_epi:get_handle(?MODULE),
+ couch_epi:apply(Handle, chttpd, Func, Args, Opts).
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/ecf745eb/src/chttpd_httpd_handlers.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_httpd_handlers.erl b/src/chttpd_httpd_handlers.erl
new file mode 100644
index 0000000..b91aae9
--- /dev/null
+++ b/src/chttpd_httpd_handlers.erl
@@ -0,0 +1,43 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(chttpd_httpd_handlers).
+
+-export([url_handler/1, db_handler/1, design_handler/1]).
+
+url_handler(<<>>) -> fun chttpd_misc:handle_welcome_req/1;
+url_handler(<<"favicon.ico">>) -> fun chttpd_misc:handle_favicon_req/1;
+url_handler(<<"_utils">>) -> fun chttpd_misc:handle_utils_dir_req/1;
+url_handler(<<"_all_dbs">>) -> fun chttpd_misc:handle_all_dbs_req/1;
+url_handler(<<"_active_tasks">>) -> fun chttpd_misc:handle_task_status_req/1;
+url_handler(<<"_node">>) -> fun chttpd_misc:handle_node_req/1;
+url_handler(<<"_reload_query_servers">>) -> fun chttpd_misc:handle_reload_query_servers_req/1;
+url_handler(<<"_replicate">>) -> fun chttpd_misc:handle_replicate_req/1;
+url_handler(<<"_uuids">>) -> fun chttpd_misc:handle_uuids_req/1;
+url_handler(<<"_session">>) -> fun chttpd_auth:handle_session_req/1;
+url_handler(<<"_up">>) -> fun chttpd_misc:handle_up_req/1;
+url_handler(_) -> no_match.
+
+db_handler(<<"_view_cleanup">>) -> fun chttpd_db:handle_view_cleanup_req/2;
+db_handler(<<"_compact">>) -> fun chttpd_db:handle_compact_req/2;
+db_handler(<<"_design">>) -> fun chttpd_db:handle_design_req/2;
+db_handler(<<"_temp_view">>) -> fun chttpd_view:handle_temp_view_req/2;
+db_handler(<<"_changes">>) -> fun chttpd_db:handle_changes_req/2;
+db_handler(_) -> no_match.
+
+design_handler(<<"_view">>) -> fun chttpd_view:handle_view_req/3;
+design_handler(<<"_show">>) -> fun chttpd_show:handle_doc_show_req/3;
+design_handler(<<"_list">>) -> fun chttpd_show:handle_view_list_req/3;
+design_handler(<<"_update">>) -> fun chttpd_show:handle_doc_update_req/3;
+design_handler(<<"_info">>) -> fun chttpd_db:handle_design_info_req/3;
+design_handler(<<"_rewrite">>) -> fun chttpd_rewrite:handle_rewrite_req/3;
+design_handler(_) -> no_match.
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/ecf745eb/src/chttpd_sup.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_sup.erl b/src/chttpd_sup.erl
index 0213c5f..a4851e2 100644
--- a/src/chttpd_sup.erl
+++ b/src/chttpd_sup.erl
@@ -27,6 +27,7 @@ init([]) ->
{ok, {{one_for_one, 3, 10}, [
?CHILD(chttpd, worker),
?CHILD(chttpd_auth_cache, worker),
+ chttpd_handlers:provider(chttpd, chttpd_httpd_handlers),
{chttpd_auth_cache_lru,
{ets_lru, start_link, [chttpd_auth_cache_lru, lru_opts()]},
permanent, 5000, worker, [ets_lru]}
[3/6] chttpd commit: updated refs/heads/add-manual-migration-logic to
df0da70
Posted by ch...@apache.org.
Validate host header
See enabling commit in couchdb-couch
COUCHDB-2752
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/3b80c7fd
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/3b80c7fd
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/3b80c7fd
Branch: refs/heads/add-manual-migration-logic
Commit: 3b80c7fdda0d365283cef8d47dc5f453ed8b7042
Parents: 6697f3f
Author: Robert Newson <rn...@apache.org>
Authored: Fri Jul 17 18:15:31 2015 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Fri Jul 17 18:15:31 2015 +0100
----------------------------------------------------------------------
src/chttpd.erl | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/3b80c7fd/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index f6ce530..fe8dfea 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -203,6 +203,7 @@ handle_request(MochiReq0) ->
Result =
try
+ couch_httpd:validate_host(HttpReq),
check_request_uri_length(RawUri),
case chttpd_cors:maybe_handle_preflight_request(HttpReq) of
not_preflight ->
[6/6] chttpd commit: updated refs/heads/add-manual-migration-logic to
df0da70
Posted by ch...@apache.org.
Don't allow security updates during cassim migration
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/df0da709
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/df0da709
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/df0da709
Branch: refs/heads/add-manual-migration-logic
Commit: df0da709d09fef7676d9ab436b58a6543ce6b7c4
Parents: 5022a94
Author: Russell Branca <ch...@apache.org>
Authored: Fri Jun 26 22:30:23 2015 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Tue Jul 21 20:50:17 2015 +0000
----------------------------------------------------------------------
src/chttpd.erl | 3 +++
src/chttpd_db.erl | 10 +++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/df0da709/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 1b12db0..539eae1 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -767,6 +767,9 @@ error_info({missing_stub, Reason}) ->
{412, <<"missing_stub">>, Reason};
error_info(request_entity_too_large) ->
{413, <<"too_large">>, <<"the request entity is too large">>};
+error_info({error, security_migration_updates_disabled}) ->
+ {503, <<"security_migration">>, <<"Updates to security docs are disabled during "
+ "security migration.">>};
error_info(not_implemented) ->
{501, <<"not_implemented">>, <<"this feature is not yet implemented">>};
error_info(timeout) ->
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/df0da709/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 207bc3f..97a70e5 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -1433,8 +1433,8 @@ demonitor_refs(Refs) when is_list(Refs) ->
%% record makes it difficult to separate. This function should be refactored and
%% moved into cassim once couch_doc_from_req and update_doc are reworked.
put_security(#httpd{user_ctx=Ctx}=Req, Db, FetchRev) ->
- case cassim:is_enabled() of
- true ->
+ case {cassim:is_enabled(), cassim:metadata_db_exists()} of
+ {true, true} ->
DbName = Db#db.name,
DocId = cassim_metadata_cache:security_meta_id(DbName),
{SecObj0} = chttpd:json_body(Req),
@@ -1464,7 +1464,11 @@ put_security(#httpd{user_ctx=Ctx}=Req, Db, FetchRev) ->
HttpCode = http_code_from_status(Status),
ResponseHeaders = [{"Etag", Etag}],
send_json(Req, HttpCode, ResponseHeaders, Body);
- false ->
+ {false, true} ->
+ throw({error, security_migration_updates_disabled});
+ %% handle completely disabled case and also cassim setting enabled but
+ %% metadata db does not exist.
+ _ ->
SecObj = chttpd:json_body(Req),
case fabric:set_security(Db, SecObj, [{user_ctx, Ctx}]) of
ok ->
[2/6] chttpd commit: updated refs/heads/add-manual-migration-logic to
df0da70
Posted by ch...@apache.org.
Unify headers to be a list to avoid crashing CORS
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/6697f3f2
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/6697f3f2
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/6697f3f2
Branch: refs/heads/add-manual-migration-logic
Commit: 6697f3f2d0d26670bfbe87ba0bd342a34daf0a49
Parents: 9ddbd04
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Thu Jul 16 13:54:38 2015 -0700
Committer: Russell Branca <ch...@apache.org>
Committed: Thu Jul 16 14:30:29 2015 -0700
----------------------------------------------------------------------
src/chttpd_db.erl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/6697f3f2/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 7f63023..c54340c 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -789,7 +789,7 @@ send_doc_efficiently(Req, #doc{atts=Atts}=Doc, Headers, Options) ->
[attachments, follows, att_encoding_info | Options])),
{ContentType, Len} = couch_doc:len_doc_to_multi_part_stream(
Boundary,JsonBytes, Atts, true),
- CType = {<<"Content-Type">>, ContentType},
+ CType = {"Content-Type", ContentType},
{ok, Resp} = start_response_length(Req, 200, [CType|Headers], Len),
couch_doc:doc_to_multi_part_stream(Boundary,JsonBytes,Atts,
fun(Data) -> couch_httpd:send(Resp, Data) end, true)
@@ -1077,7 +1077,7 @@ db_attachment_req(#httpd{method='GET',mochi_req=MochiReq}=Req, Db, DocId, FileNa
Ranges = parse_ranges(MochiReq:get(range), Len),
case {Enc, Ranges} of
{identity, [{From, To}]} ->
- Headers1 = [{<<"Content-Range">>, make_content_range(From, To, Len)}]
+ Headers1 = [{"Content-Range", make_content_range(From, To, Len)}]
++ Headers,
{ok, Resp} = start_response_length(Req, 206, Headers1, To - From + 1),
couch_att:range_foldl(Att, From, To + 1,
[5/6] chttpd commit: updated refs/heads/add-manual-migration-logic to
df0da70
Posted by ch...@apache.org.
Merge remote-tracking branch 'cloudant/dynamic-handlers'
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/5022a94d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/5022a94d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/5022a94d
Branch: refs/heads/add-manual-migration-logic
Commit: 5022a94d3dca1ba5472b236eedc893ffc403514e
Parents: 3b80c7f ecf745e
Author: Robert Newson <rn...@apache.org>
Authored: Tue Jul 21 13:33:00 2015 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Jul 21 13:33:00 2015 +0100
----------------------------------------------------------------------
src/chttpd.erl | 50 ++++---------------------------
src/chttpd_db.erl | 11 +++----
src/chttpd_handlers.erl | 60 ++++++++++++++++++++++++++++++++++++++
src/chttpd_httpd_handlers.erl | 43 +++++++++++++++++++++++++++
src/chttpd_sup.erl | 1 +
5 files changed, 113 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/5022a94d/src/chttpd.erl
----------------------------------------------------------------------