You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2014/07/13 15:00:46 UTC

[1/3] couch commit: updated refs/heads/1994-merge-rcouch to 7ad4bc6

Repository: couchdb-couch
Updated Branches:
  refs/heads/1994-merge-rcouch 5eb93a4f2 -> 7ad4bc655


send a doc without attachment as multipart if needded


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

Branch: refs/heads/1994-merge-rcouch
Commit: 7ad4bc655a7c40b3eddc8eb4096576ff7b293180
Parents: 0aa924a
Author: benoitc <bc...@gmail.com>
Authored: Tue Feb 18 21:52:57 2014 +0100
Committer: benoitc <bc...@gmail.com>
Committed: Sun Jul 13 14:59:53 2014 +0200

----------------------------------------------------------------------
 src/couch_doc.erl | 56 ++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 41 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/7ad4bc65/src/couch_doc.erl
----------------------------------------------------------------------
diff --git a/src/couch_doc.erl b/src/couch_doc.erl
index efde8c1..6c27e3d 100644
--- a/src/couch_doc.erl
+++ b/src/couch_doc.erl
@@ -18,7 +18,8 @@
 -export([from_json_obj/1,to_json_obj/2,has_stubs/1, merge_stubs/2]).
 -export([validate_docid/1]).
 -export([doc_from_multi_part_stream/2]).
--export([doc_to_multi_part_stream/5, len_doc_to_multi_part_stream/4]).
+-export([doc_to_multi_part_stream/5, doc_to_multi_part_stream/6,
+         len_doc_to_multi_part_stream/4, len_doc_to_multi_part_stream/5]).
 -export([abort_multi_part_stream/1]).
 -export([to_path/1]).
 -export([mp_parse_doc/2]).
@@ -461,6 +462,12 @@ fold_streamed_data(RcvFun, LenLeft, Fun, Acc) when LenLeft > 0->
     fold_streamed_data(RcvFun, LenLeft - size(Bin), Fun, ResultAcc).
 
 len_doc_to_multi_part_stream(Boundary, JsonBytes, Atts, SendEncodedAtts) ->
+    len_doc_to_multi_part_stream(Boundary, JsonBytes, Atts,
+                                 SendEncodedAtts, false).
+
+len_doc_to_multi_part_stream(Boundary, JsonBytes, Atts, SendEncodedAtts,
+                             ForceMp) ->
+
     AttsSize = lists:foldl(fun(Att, AccAttsSize) ->
             #att{
                 data=Data,
@@ -505,29 +512,48 @@ len_doc_to_multi_part_stream(Boundary, JsonBytes, Atts, SendEncodedAtts) ->
                 end
             end
         end, 0, Atts),
-    if AttsSize == 0 ->
-        {<<"application/json">>, iolist_size(JsonBytes)};
-    true ->
-        {<<"multipart/related; boundary=\"", Boundary/binary, "\"">>,
-            2 + % "--"
-            size(Boundary) +
-            36 + % "\r\ncontent-type: application/json\r\n\r\n"
-            iolist_size(JsonBytes) +
-            4 + % "\r\n--"
-            size(Boundary) +
-            + AttsSize +
-            2 % "--"
-            }
+    case AttsSize of
+        0 when ForceMp /= true ->
+            {<<"application/json">>, iolist_size(JsonBytes)};
+        0 ->
+            {<<"multipart/related; boundary=\"", Boundary/binary, "\"">>,
+                2 + % "--"
+                size(Boundary) +
+                36 + % "\r\ncontent-type: application/json\r\n\r\n"
+                iolist_size(JsonBytes) +
+                4 + % "\r\n--"
+                size(Boundary) +
+                2};
+        _ ->
+            {<<"multipart/related; boundary=\"", Boundary/binary, "\"">>,
+                2 + % "--"
+                size(Boundary) +
+                36 + % "\r\ncontent-type: application/json\r\n\r\n"
+                iolist_size(JsonBytes) +
+                4 + % "\r\n--"
+                size(Boundary) +
+                + AttsSize +
+                2 % "--"
+                }
     end.
 
 doc_to_multi_part_stream(Boundary, JsonBytes, Atts, WriteFun,
-    SendEncodedAtts) ->
+                         SendEncodedAtts) ->
+    doc_to_multi_part_stream(Boundary, JsonBytes, Atts, WriteFun,
+                         SendEncodedAtts, false).
+
+doc_to_multi_part_stream(Boundary, JsonBytes, Atts, WriteFun,
+    SendEncodedAtts, ForceMp) ->
     case lists:any(fun(#att{data=Data})-> Data /= stub end, Atts) of
     true ->
         WriteFun([<<"--", Boundary/binary,
                 "\r\nContent-Type: application/json\r\n\r\n">>,
                 JsonBytes, <<"\r\n--", Boundary/binary>>]),
         atts_to_mp(Atts, Boundary, WriteFun, SendEncodedAtts);
+    false when ForceMp ->
+        WriteFun([<<"--", Boundary/binary,
+                "\r\nContent-Type: application/json\r\n\r\n">>,
+                  JsonBytes, <<"\r\n--", Boundary/binary, "--" >>]);
     false ->
         WriteFun(JsonBytes)
     end.


[2/3] couch commit: updated refs/heads/1994-merge-rcouch to 7ad4bc6

Posted by be...@apache.org.
use uname p instead of the arch command

fix RCOUCH-21


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

Branch: refs/heads/1994-merge-rcouch
Commit: 0aa924aa8fdce4ded5f0cc4cb9414e2d585861e5
Parents: 74e57b5
Author: benoitc <bc...@gmail.com>
Authored: Sun Feb 16 20:59:52 2014 +0100
Committer: benoitc <bc...@gmail.com>
Committed: Sun Jul 13 14:59:53 2014 +0200

----------------------------------------------------------------------
 build_spidermonkey.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0aa924aa/build_spidermonkey.sh
----------------------------------------------------------------------
diff --git a/build_spidermonkey.sh b/build_spidermonkey.sh
index 68dc813..9607716 100755
--- a/build_spidermonkey.sh
+++ b/build_spidermonkey.sh
@@ -48,7 +48,7 @@ CXX=g++
 PATCH=patch
 case "$SYSTEM" in
     Linux)
-        ARCH=`arch 2>/dev/null`
+        ARCH=`(uname -p) 2>/dev/null`
         ;;
     FreeBSD|OpenBSD|NetBSD)
         ARCH=`(uname -p) 2>/dev/null`
@@ -84,7 +84,7 @@ build_nspr()
     NSPR_CONFIGURE_ENV=""
     case "$SYSTEM" in
         Linux)
-            ARCH=`arch 2>/dev/null`
+            ARCH=`(uname -p) 2>/dev/null`
             if [ "$ARCH" = "x86_64" ]; then
                 NSPR_CONFIGURE_ENV="--enable-64bit"
             fi


[3/3] couch commit: updated refs/heads/1994-merge-rcouch to 7ad4bc6

Posted by be...@apache.org.
force utf8


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

Branch: refs/heads/1994-merge-rcouch
Commit: 74e57b5100c178a03b88125e8b0444811313fa70
Parents: 5eb93a4
Author: benoitc <bc...@gmail.com>
Authored: Sun Feb 16 15:44:35 2014 +0100
Committer: benoitc <bc...@gmail.com>
Committed: Sun Jul 13 14:59:53 2014 +0200

----------------------------------------------------------------------
 include/couch_db.hrl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/74e57b51/include/couch_db.hrl
----------------------------------------------------------------------
diff --git a/include/couch_db.hrl b/include/couch_db.hrl
index 539dd4a..449993e 100644
--- a/include/couch_db.hrl
+++ b/include/couch_db.hrl
@@ -23,7 +23,7 @@
 
 -define(REWRITE_COUNT, couch_rewrite_count).
 
--define(JSON_ENCODE(V), jiffy:encode(V, [uescape])).
+-define(JSON_ENCODE(V), jiffy:encode(V, [force_utf8])).
 -define(JSON_DECODE(V), couch_util:json_decode(V)).
 
 -define(b2l(V), binary_to_list(V)).