You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2009/04/19 22:09:50 UTC

svn commit: r766509 - in /couchdb/branches/0.9.x: ./ etc/default/couchdb share/www/script/couch_tests.js share/www/script/test/form_submit.js src/couchdb/couch_httpd.erl src/couchdb/couch_httpd_db.erl

Author: davisp
Date: Sun Apr 19 20:09:49 2009
New Revision: 766509

URL: http://svn.apache.org/viewvc?rev=766509&view=rev
Log:
Merged 766505 from trunk.

Added:
    couchdb/branches/0.9.x/share/www/script/test/form_submit.js
      - copied unchanged from r766505, couchdb/trunk/share/www/script/test/form_submit.js
Modified:
    couchdb/branches/0.9.x/   (props changed)
    couchdb/branches/0.9.x/etc/default/couchdb   (props changed)
    couchdb/branches/0.9.x/share/www/script/couch_tests.js
    couchdb/branches/0.9.x/src/couchdb/couch_httpd.erl
    couchdb/branches/0.9.x/src/couchdb/couch_httpd_db.erl

Propchange: couchdb/branches/0.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Apr 19 20:09:49 2009
@@ -1,3 +1,3 @@
 /couchdb/branches/design_resources:751716-751803
 /couchdb/branches/form:729440-730015
-/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373
+/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505

Propchange: couchdb/branches/0.9.x/etc/default/couchdb
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Apr 19 20:09:49 2009
@@ -1,4 +1,4 @@
 /couchdb/branches/design_resources/etc/default/couchdb:751716-751803
 /couchdb/branches/form/etc/default/couchdb:729440-730015
-/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373
+/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505
 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440

Modified: couchdb/branches/0.9.x/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/share/www/script/couch_tests.js?rev=766509&r1=766508&r2=766509&view=diff
==============================================================================
--- couchdb/branches/0.9.x/share/www/script/couch_tests.js [utf-8] (original)
+++ couchdb/branches/0.9.x/share/www/script/couch_tests.js [utf-8] Sun Apr 19 20:09:49 2009
@@ -67,6 +67,7 @@
 loadTest("compact.js");
 loadTest("purge.js");
 loadTest("config.js");
+loadTest("form_submit.js");
 loadTest("security_validation.js");
 loadTest("stats.js");
 loadTest("rev_stemming.js");

Modified: couchdb/branches/0.9.x/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_httpd.erl?rev=766509&r1=766508&r2=766509&view=diff
==============================================================================
--- couchdb/branches/0.9.x/src/couchdb/couch_httpd.erl (original)
+++ couchdb/branches/0.9.x/src/couchdb/couch_httpd.erl Sun Apr 19 20:09:49 2009
@@ -415,6 +415,8 @@
 error_info(file_exists) ->
     {412, <<"file_exists">>, <<"The database could not be "
         "created, the file already exists.">>};
+error_info({bad_ctype, Reason}) ->
+    {415, <<"bad_content_type">>, Reason};
 error_info({Error, Reason}) ->
     {500, couch_util:to_binary(Error), couch_util:to_binary(Reason)};
 error_info(Error) ->

Modified: couchdb/branches/0.9.x/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_httpd_db.erl?rev=766509&r1=766508&r2=766509&view=diff
==============================================================================
--- couchdb/branches/0.9.x/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/branches/0.9.x/src/couchdb/couch_httpd_db.erl Sun Apr 19 20:09:49 2009
@@ -491,6 +491,12 @@
     end;
 
 db_doc_req(#httpd{method='POST'}=Req, Db, DocId) ->
+    case couch_httpd:header_value(Req, "content-type") of
+    "multipart/form-data" ++  _Rest ->
+        ok;
+    _Else ->
+        throw({bad_ctype, <<"Invalid Content-Type header for form upload">>})
+    end,
     Form = couch_httpd:parse_form(Req),
     Rev = couch_doc:parse_rev(list_to_binary(proplists:get_value("_rev", Form))),
     {ok, [{ok, Doc}]} = couch_db:open_doc_revs(Db, DocId, [Rev], []),