couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject git commit: Fix replicator doc GET requests for many revisions
Date Thu, 17 Nov 2011 14:16:14 GMT
Updated Branches:
  refs/heads/1.1.x 2f6743b3a -> 6aa81c639


Fix replicator doc GET requests for many revisions

Mochiweb limits request lines up to 8192 characters but the
replicator wasn't accounting for the verb and protocol parts
of the first request line ("GET " + " HTTP/1.1\r\n")

Closes COUCHDB-1340.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6aa81c63
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6aa81c63
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6aa81c63

Branch: refs/heads/1.1.x
Commit: 6aa81c6398bbb1ca4f22d98275c175c2ae8dbde4
Parents: 2f6743b
Author: Filipe David Borba Manana <fdmanana@apache.org>
Authored: Thu Nov 17 14:08:36 2011 +0000
Committer: Filipe David Borba Manana <fdmanana@apache.org>
Committed: Thu Nov 17 14:08:36 2011 +0000

----------------------------------------------------------------------
 src/couchdb/couch_rep_reader.erl |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/6aa81c63/src/couchdb/couch_rep_reader.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_rep_reader.erl b/src/couchdb/couch_rep_reader.erl
index 1e8ca07..0dca225 100644
--- a/src/couchdb/couch_rep_reader.erl
+++ b/src/couchdb/couch_rep_reader.erl
@@ -177,7 +177,7 @@ calculate_new_high_seq(State) ->
     hd(State#state.opened_seqs).
 
 split_revlist(Rev, {[CurrentAcc|Rest], BaseLength, Length}) ->
-    case Length+size(Rev)+3 > 8192 of
+    case Length+size(Rev)+3 >= 8192 of
     false ->
         {[[Rev|CurrentAcc] | Rest], BaseLength, Length+size(Rev)+3};
     true ->
@@ -214,7 +214,9 @@ 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) ++ "&open_revs=[]"),
+    BaseLength = length(
+        "GET " ++ couch_rep_httpc:full_url(BaseReq) ++
+        "&open_revs=[]" ++ " HTTP/1.1\r\n"),
 
     {RevLists, _, _} = lists:foldl(fun split_revlist/2,
         {[[]], BaseLength, BaseLength}, couch_doc:revs_to_strs(Revs)),


Mime
View raw message