couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r815309 - in /couchdb/branches/0.10.x: share/www/script/test/attachments.js src/couchdb/couch_httpd_db.erl
Date Tue, 15 Sep 2009 13:05:13 GMT
Author: jan
Date: Tue Sep 15 13:05:12 2009
New Revision: 815309

URL: http://svn.apache.org/viewvc?rev=815309&view=rev
Log:
fix attachments with an undefined Content-Length header and no TE, patch by Benoit Chesneau,
closes COUCHDB-497

Modified:
    couchdb/branches/0.10.x/share/www/script/test/attachments.js
    couchdb/branches/0.10.x/src/couchdb/couch_httpd_db.erl

Modified: couchdb/branches/0.10.x/share/www/script/test/attachments.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/share/www/script/test/attachments.js?rev=815309&r1=815308&r2=815309&view=diff
==============================================================================
--- couchdb/branches/0.10.x/share/www/script/test/attachments.js (original)
+++ couchdb/branches/0.10.x/share/www/script/test/attachments.js Tue Sep 15 13:05:12 2009
@@ -225,4 +225,16 @@
     headers: {"if-none-match": etag}
   });
   T(xhr.status == 304);
+
+  // test COUCHDB-497 - empty attachments
+  var xhr = CouchDB.request("PUT", "/test_suite_db/bin_doc5/empty.txt?rev="+rev, {
+    headers:{"Content-Type":"text/plain;charset=utf-8", "Content-Length": "0"},
+    body:""
+  });
+  TEquals(201, xhr.status, "should send 201 Accepted");
+  var rev = JSON.parse(xhr.responseText).rev;
+  var xhr = CouchDB.request("PUT", "/test_suite_db/bin_doc5/empty.txt?rev="+rev, {
+    headers:{"Content-Type":"text/plain;charset=utf-8"}
+  });
+  TEquals(201, xhr.status, "should send 201 Accepted");
 };

Modified: couchdb/branches/0.10.x/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/src/couchdb/couch_httpd_db.erl?rev=815309&r1=815308&r2=815309&view=diff
==============================================================================
--- couchdb/branches/0.10.x/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/branches/0.10.x/src/couchdb/couch_httpd_db.erl Tue Sep 15 13:05:12 2009
@@ -940,7 +940,7 @@
                     end,
                 data = case couch_httpd:body_length(Req) of
                     undefined ->
-                        undefined;
+                        <<"">>;
                     {unknown_transfer_encoding, Unknown} ->
                         exit({unknown_transfer_encoding, Unknown});
                     chunked ->
@@ -949,7 +949,7 @@
                                 ChunkFun, InitState)
                         end;
                     0 ->
-                        <<>>;
+                        <<"">>;
                     Length when is_integer(Length) ->
                         fun() -> couch_httpd:recv(Req, 0) end;
                     Length ->



Mime
View raw message