From 2e7ed944f2d23c2436f056e9649473cc891bd6e6 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Thu, 27 Jan 2011 15:07:44 +0000 Subject: Fix calculation of URL length in replicator COUCHDB-644, COUCHDB-1044 git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1064147 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_rep_reader.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/couchdb/couch_rep_reader.erl b/src/couchdb/couch_rep_reader.erl index 1bd3e171..0d344e5c 100644 --- a/src/couchdb/couch_rep_reader.erl +++ b/src/couchdb/couch_rep_reader.erl @@ -177,9 +177,9 @@ calculate_new_high_seq(State) -> hd(State#state.opened_seqs). split_revlist(Rev, {[CurrentAcc|Rest], BaseLength, Length}) -> - case Length+size(Rev) > 8192 of + case Length+size(Rev)+3 > 8192 of false -> - {[[Rev|CurrentAcc] | Rest], BaseLength, Length+size(Rev)}; + {[[Rev|CurrentAcc] | Rest], BaseLength, Length+size(Rev)+3}; true -> {[[Rev],CurrentAcc|Rest], BaseLength, BaseLength} end. @@ -214,7 +214,7 @@ open_doc_revs(#http_db{url = Url} = DbS, DocId, Revs) -> %% MochiWeb into multiple requests BaseQS = [{revs,true}, {latest,true}, {att_encoding_info,true}], BaseReq = DbS#http_db{resource=encode_doc_id(DocId), qs=BaseQS}, - BaseLength = length(couch_rep_httpc:full_url(BaseReq)) + 11, % &open_revs= + BaseLength = length(couch_rep_httpc:full_url(BaseReq) ++ "&open_revs=[]"), {RevLists, _, _} = lists:foldl(fun split_revlist/2, {[[]], BaseLength, BaseLength}, couch_doc:revs_to_strs(Revs)), -- cgit v1.2.3