From 7bd137827bb60481569f26bed3028398a5e5aa06 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Thu, 9 Oct 2014 18:31:59 +0200 Subject: Limit get-entries to 1000 entries at the time. --- src/v1.erl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') 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, -- cgit v1.1