diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-12-23 11:27:37 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-12-23 11:27:37 +0000 |
commit | abf46298f3e98bebd89d8daa001374cba57dcfce (patch) | |
tree | ba8756f517ae3a544d5bdb4046d4c7e5bb65a7c1 /src/couchdb/couch_rep_httpc.erl | |
parent | 214b6f9b9d4c9cd9182d2ce56b9a5ffd9f6d0864 (diff) |
Merged revision 1052227 from trunk:
Fix: replicator didn't use the HTTP settings defined in the .ini config
Issue found by Randall Leeds. Thanks.
Closes COUCHDB-992
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1052229 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_rep_httpc.erl')
-rw-r--r-- | src/couchdb/couch_rep_httpc.erl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/couchdb/couch_rep_httpc.erl b/src/couchdb/couch_rep_httpc.erl index 7a5bd18b..cfd815b4 100644 --- a/src/couchdb/couch_rep_httpc.erl +++ b/src/couchdb/couch_rep_httpc.erl @@ -93,6 +93,7 @@ db_exists(Req, CanonicalUrl, CreateDB) -> end, case catch ibrowse:send_req(Url, HeadersFun(head), head, [], Options) of {ok, "200", _, _} -> + config_http(CanonicalUrl), Req#http_db{url = CanonicalUrl}; {ok, "301", RespHeaders, _} -> RedirectUrl = redirect_url(RespHeaders, Req#http_db.url), @@ -110,6 +111,19 @@ db_exists(Req, CanonicalUrl, CreateDB) -> throw({db_not_found, ?l2b(Url)}) end. +config_http(Url) -> + #url{host = Host, port = Port} = ibrowse_lib:parse_url(Url), + ok = ibrowse:set_max_sessions(Host, Port, list_to_integer( + couch_config:get("replicator", "max_http_sessions", "20"))), + ok = ibrowse:set_max_pipeline_size(Host, Port, list_to_integer( + couch_config:get("replicator", "max_http_pipeline_size", "50"))), + ok = couch_config:register( + fun("replicator", "max_http_sessions", MaxSessions) -> + ibrowse:set_max_sessions(Host, Port, list_to_integer(MaxSessions)); + ("replicator", "max_http_pipeline_size", PipeSize) -> + ibrowse:set_max_pipeline_size(Host, Port, list_to_integer(PipeSize)) + end). + redirect_url(RespHeaders, OrigUrl) -> MochiHeaders = mochiweb_headers:make(RespHeaders), RedUrl = mochiweb_headers:get_value("Location", MochiHeaders), |