couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r786337 - in /couchdb/trunk/src/couchdb: couch_db.hrl couch_httpd_db.erl couch_httpd_show.erl couch_httpd_view.erl
Date Thu, 18 Jun 2009 23:43:41 GMT
Author: davisp
Date: Thu Jun 18 23:43:40 2009
New Revision: 786337

URL: http://svn.apache.org/viewvc?rev=786337&view=rev
Log:
Fixes COUCHDB-383 - Ignore extra URL parameters.

No one opposed the switch so here it is.


Modified:
    couchdb/trunk/src/couchdb/couch_db.hrl
    couchdb/trunk/src/couchdb/couch_httpd_db.erl
    couchdb/trunk/src/couchdb/couch_httpd_show.erl
    couchdb/trunk/src/couchdb/couch_httpd_view.erl

Modified: couchdb/trunk/src/couchdb/couch_db.hrl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db.hrl?rev=786337&r1=786336&r2=786337&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db.hrl (original)
+++ couchdb/trunk/src/couchdb/couch_db.hrl Thu Jun 18 23:43:40 2009
@@ -167,7 +167,6 @@
     include_docs = false,
     stale = false,
     multi_get = false,
-    ignore = false,
     callback = nil
 }).
 

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=786337&r1=786336&r2=786337&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Thu Jun 18 23:43:40 2009
@@ -337,7 +337,7 @@
         limit = Limit,
         skip = SkipCount,
         direction = Dir
-    } = QueryArgs = couch_httpd_view:parse_view_params(Req, nil, map, strict),
+    } = QueryArgs = couch_httpd_view:parse_view_params(Req, nil, map),
 
     {ok, Info} = couch_db:get_db_info(Db),
     CurrentEtag = couch_httpd:make_etag(proplists:get_value(update_seq, Info)),
@@ -453,7 +453,7 @@
         limit = Limit,
         skip = SkipCount,
         direction = Dir
-    } = QueryArgs = couch_httpd_view:parse_view_params(Req, Keys, map, strict),
+    } = QueryArgs = couch_httpd_view:parse_view_params(Req, Keys, map),
     {ok, Info} = couch_db:get_db_info(Db),
     CurrentEtag = couch_httpd:make_etag(proplists:get_value(update_seq, Info)),
     couch_httpd:etag_respond(Req, CurrentEtag, fun() -> 

Modified: couchdb/trunk/src/couchdb/couch_httpd_show.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?rev=786337&r1=786336&r2=786337&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_show.erl Thu Jun 18 23:43:40 2009
@@ -94,7 +94,7 @@
     Reduce = couch_httpd_view:get_reduce_type(Req),
     case couch_view:get_map_view(Db, DesignId, ViewName, Stale) of
     {ok, View, Group} ->    
-        QueryArgs = couch_httpd_view:parse_view_params(Req, Keys, map, ignore),
+        QueryArgs = couch_httpd_view:parse_view_params(Req, Keys, map),
         output_map_list(Req, Lang, ListSrc, View, Group, Db, QueryArgs, Keys);
     {not_found, _Reason} ->
         case couch_view:get_reduce_view(Db, DesignId, ViewName, Stale) of
@@ -102,13 +102,13 @@
             case Reduce of
             false ->
                 QueryArgs = couch_httpd_view:parse_view_params(
-                    Req, Keys, map_red, ignore
+                    Req, Keys, map_red
                 ),
                 MapView = couch_view:extract_map_view(ReduceView),
                 output_map_list(Req, Lang, ListSrc, MapView, Group, Db, QueryArgs, Keys);
             _ ->
                 QueryArgs = couch_httpd_view:parse_view_params(
-                    Req, Keys, reduce, ignore
+                    Req, Keys, reduce
                 ),
                 output_reduce_list(Req, Lang, ListSrc, ReduceView, Group, Db, QueryArgs,
Keys)
             end;

Modified: couchdb/trunk/src/couchdb/couch_httpd_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=786337&r1=786336&r2=786337&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_view.erl Thu Jun 18 23:43:40 2009
@@ -15,7 +15,7 @@
 
 -export([handle_view_req/2,handle_temp_view_req/2]).
 
--export([get_stale_type/1, get_reduce_type/1, parse_view_params/4]).
+-export([get_stale_type/1, get_reduce_type/1, parse_view_params/3]).
 -export([make_view_fold_fun/6, finish_view_fold/3, view_row_obj/3]).
 -export([view_group_etag/1, view_group_etag/2, make_reduce_fold_funs/5]).
 -export([design_doc_view/5]).
@@ -31,18 +31,18 @@
     Reduce = get_reduce_type(Req),
     Result = case couch_view:get_map_view(Db, DesignId, ViewName, Stale) of
     {ok, View, Group} ->
-        QueryArgs = parse_view_params(Req, Keys, map, strict),
+        QueryArgs = parse_view_params(Req, Keys, map),
         output_map_view(Req, View, Group, Db, QueryArgs, Keys);
     {not_found, Reason} ->
         case couch_view:get_reduce_view(Db, DesignId, ViewName, Stale) of
         {ok, ReduceView, Group} ->
             case Reduce of
             false ->
-                QueryArgs = parse_view_params(Req, Keys, red_map, strict),
+                QueryArgs = parse_view_params(Req, Keys, red_map),
                 MapView = couch_view:extract_map_view(ReduceView),
                 output_map_view(Req, MapView, Group, Db, QueryArgs, Keys);
             _ ->
-                QueryArgs = parse_view_params(Req, Keys, reduce, strict),
+                QueryArgs = parse_view_params(Req, Keys, reduce),
                 output_reduce_view(Req, ReduceView, Group, QueryArgs, Keys)
             end;
         _ ->
@@ -82,12 +82,12 @@
     Keys = proplists:get_value(<<"keys">>, Props, nil),
     case proplists:get_value(<<"reduce">>, Props, null) of
     null ->
-        QueryArgs = parse_view_params(Req, Keys, map, strict),
+        QueryArgs = parse_view_params(Req, Keys, map),
         {ok, View, Group} = couch_view:get_temp_map_view(Db, Language, 
             DesignOptions, MapSrc),
         output_map_view(Req, View, Group, Db, QueryArgs, Keys);
     RedSrc ->
-        QueryArgs = parse_view_params(Req, Keys, reduce, strict),
+        QueryArgs = parse_view_params(Req, Keys, reduce),
         {ok, View, Group} = couch_view:get_temp_reduce_view(Db, Language, 
             DesignOptions, MapSrc, RedSrc),
         output_reduce_view(Req, View, Group, QueryArgs, Keys)
@@ -196,7 +196,7 @@
 get_reduce_type(Req) ->
     list_to_atom(couch_httpd:qs_value(Req, "reduce", "true")).
 
-parse_view_params(Req, Keys, ViewType, IgnoreType) ->
+parse_view_params(Req, Keys, ViewType) ->
     QueryList = couch_httpd:qs(Req),
     QueryParams = 
     lists:foldl(fun({K, V}, Acc) ->
@@ -208,8 +208,7 @@
     end,
     Args = #view_query_args{
         view_type=ViewType,
-        multi_get=IsMultiGet,
-        ignore=IgnoreType
+        multi_get=IsMultiGet
     },
     QueryArgs = lists:foldl(fun({K, V}, Args2) ->
         validate_view_query(K, V, Args2)
@@ -351,14 +350,8 @@
     end;
 validate_view_query(include_docs, _Value, Args) ->
     Args;
-validate_view_query(extra, {Key, _}, Args) ->
-    case Args#view_query_args.ignore of
-        strict ->
-            Msg = io_lib:format("Invalid URL parameter: ~p", [Key]),
-            throw({query_parse_error, ?l2b(Msg)});
-        _ ->
-            Args
-    end.
+validate_view_query(extra, _Value, Args) ->
+    Args.
 
 make_view_fold_fun(Req, QueryArgs, Etag, Db, TotalViewCount, HelperFuns) ->
     #view_query_args{



Mime
View raw message