summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2014-10-09 18:31:59 +0200
committerLinus Nordberg <linus@nordberg.se>2014-10-09 18:31:59 +0200
commit7bd137827bb60481569f26bed3028398a5e5aa06 (patch)
tree6eff3b04a7084101665da9776f1b26a09667d074 /src
parent6ddb0363c5c9bb147f9a4fe0ba683bdba20b5389 (diff)
Limit get-entries to 1000 entries at the time.
Diffstat (limited to 'src')
-rw-r--r--src/v1.erl5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/v1.erl b/src/v1.erl
index 304b0a8..c1db2c3 100644
--- a/src/v1.erl
+++ b/src/v1.erl
@@ -97,15 +97,14 @@
deliver(SessionID, R).
'get-entries'(SessionID, _Env, Input) ->
- %% TODO: Limit the number of returned entries (i.e. start-end) to
- %% something reasonable.
R = case lists:sort(httpd:parse_query(Input)) of
[{"end", EndInput}, {"start", StartInput}] ->
{Start, _} = string:to_integer(StartInput),
{End, _} = string:to_integer(EndInput),
case lists:member(error, [Start, End]) of
true -> html("get-entries: bad input:", [Start, End]);
- false -> catlfish:entries(Start, End)
+ false -> catlfish:entries(Start,
+ min(max(End, Start), Start + 999))
end;
_ -> html("get-entries: bad input:", Input)
end,