Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Commit

Permalink
Fix calculation of URL length in replicator
Browse files Browse the repository at this point in the history
COUCHDB-644, COUCHDB-1044

git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1064157 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
kocolosk committed Jan 27, 2011
1 parent 4e98cf8 commit bc7b57d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/couchdb/couch_rep_reader.erl
Expand Up @@ -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.
Expand Down Expand Up @@ -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)),
Expand Down

0 comments on commit bc7b57d

Please sign in to comment.