summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_db.hrl1
-rw-r--r--src/couchdb/couch_httpd_view.erl23
2 files changed, 21 insertions, 3 deletions
diff --git a/src/couchdb/couch_db.hrl b/src/couchdb/couch_db.hrl
index 6d9081a8..78087d86 100644
--- a/src/couchdb/couch_db.hrl
+++ b/src/couchdb/couch_db.hrl
@@ -155,6 +155,7 @@
skip = 0,
group_level = 0,
reduce = true,
+ req_reduce = false,
inclusive_end=true, % aka a closed-interval
include_docs = false
}).
diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl
index e0c3f631..4054eb05 100644
--- a/src/couchdb/couch_httpd_view.erl
+++ b/src/couchdb/couch_httpd_view.erl
@@ -364,9 +364,15 @@ parse_view_query(Req, Keys, IsReduce, IgnoreExtra) ->
{"inclusive_end", "false"} ->
Args#view_query_args{inclusive_end=false};
{"reduce", "true"} ->
- Args#view_query_args{reduce=true};
+ Args#view_query_args{
+ reduce=true,
+ req_reduce=true
+ };
{"reduce", "false"} ->
- Args#view_query_args{reduce=false};
+ Args#view_query_args{
+ reduce=false,
+ req_reduce=true
+ };
{"include_docs", Value} ->
case Value of
"true" ->
@@ -401,7 +407,18 @@ parse_view_query(Req, Keys, IsReduce, IgnoreExtra) ->
ok
end;
_ ->
- ok
+ case QueryArgs#view_query_args.req_reduce of
+ true ->
+ case QueryArgs#view_query_args.reduce of
+ true ->
+ ErrMsg = <<"Bad URL parameter: reduce=true">>,
+ throw({query_parse_error, ErrMsg});
+ _ ->
+ ok
+ end;
+ _ ->
+ ok
+ end
end,
case Keys of
nil ->