couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r750969 - in /couchdb/trunk: share/www/script/test/list_views.js src/couchdb/couch_httpd.erl src/couchdb/couch_httpd_show.erl
Date Fri, 06 Mar 2009 16:45:45 GMT
Author: jchris
Date: Fri Mar  6 16:45:45 2009
New Revision: 750969

URL: http://svn.apache.org/viewvc?rev=750969&view=rev
Log:
validate reduce view list queries, make query_parse_error response code 400
thanks Jan, thanks Jason Davies. closes COUCHDB-283

Modified:
    couchdb/trunk/share/www/script/test/list_views.js
    couchdb/trunk/src/couchdb/couch_httpd.erl
    couchdb/trunk/src/couchdb/couch_httpd_show.erl

Modified: couchdb/trunk/share/www/script/test/list_views.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/list_views.js?rev=750969&r1=750968&r2=750969&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/list_views.js (original)
+++ couchdb/trunk/share/www/script/test/list_views.js Fri Mar  6 16:45:45 2009
@@ -276,4 +276,11 @@
   T(/Key: 2/.test(xhr.responseText));
   T(/FirstKey: 2/.test(xhr.responseText));
   T(/LastKey: 7/.test(xhr.responseText));
+  
+  // no multi-key fetch allowed when group=false
+  xhr = CouchDB.request("POST", "/test_suite_db/_list/lists/simpleForm/withReduce?group=false",
{
+    body: '{"keys":[2,4,5,7]}'
+  });
+  T(xhr.status == 400);
+  T(/query_parse_error/.test(xhr.responseText));
 };

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=750969&r1=750968&r2=750969&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Fri Mar  6 16:45:45 2009
@@ -386,6 +386,8 @@
 
 send_error(Req, bad_request) ->
     send_error(Req, 400, <<"bad_request">>, <<>>);
+send_error(Req, {query_parse_error, Reason}) ->
+    send_error(Req, 400, <<"query_parse_error">>, Reason);
 send_error(Req, {bad_request, Reason}) ->
     send_error(Req, 400, <<"bad_request">>, Reason);
 send_error(Req, not_found) ->

Modified: couchdb/trunk/src/couchdb/couch_httpd_show.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?rev=750969&r1=750968&r2=750969&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_show.erl Fri Mar  6 16:45:45 2009
@@ -98,6 +98,7 @@
     {not_found, _Reason} ->
         case couch_view:get_reduce_view(Db, DesignId, ViewName, Stale) of
         {ok, ReduceView, Group} ->
+            couch_httpd_view:parse_view_query(Req, Keys, true, true), % just for validation
             case Reduce of
             false ->
                 MapView = couch_view:extract_map_view(ReduceView),



Mime
View raw message