You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/28 13:59:30 UTC
[07/50] chttpd commit: updated refs/heads/master to 58020ab
Reject large Range requests
Return a 200 response for any Range request that covers the entire entity
or that contains more than 10 byte ranges.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1168196 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/0ba63fd3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/0ba63fd3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/0ba63fd3
Branch: refs/heads/master
Commit: 0ba63fd341aef9f0762ae942178dc68f926940e7
Parents: e5ecb22
Author: Robert Newson <rn...@apache.org>
Authored: Sun Sep 11 10:50:11 2011 +0000
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Jul 29 17:18:22 2014 +0100
----------------------------------------------------------------------
src/chttpd_db.erl | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/0ba63fd3/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 86653f9..cb13805 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -991,7 +991,7 @@ db_attachment_req(#httpd{method='GET',mochi_req=MochiReq}=Req, Db, DocId, FileNa
{ok, Resp} = start_response_length(Req, 206, Headers1, To - From + 1),
couch_doc:range_att_foldl(Att, From, To + 1,
fun(Seg, _) -> send(Resp, Seg) end, {ok, Resp});
- {identity, Ranges} when is_list(Ranges) ->
+ {identity, Ranges} when is_list(Ranges) andalso length(Ranges) < 10 ->
send_ranges_multipart(Req, Type, Len, Att, Ranges);
_ ->
Headers1 = Headers ++
@@ -1126,8 +1126,9 @@ parse_ranges(Ranges, Len) ->
parse_ranges([], _Len, Acc) ->
lists:reverse(Acc);
-parse_ranges([{From, To}|_], _Len, _Acc)
- when is_integer(From) andalso is_integer(To) andalso To < From ->
+parse_ranges([{0, none}|_], _Len, _Acc) ->
+ undefined;
+parse_ranges([{From, To}|_], _Len, _Acc) when is_integer(From) andalso is_integer(To) andalso To < From ->
throw(requested_range_not_satisfiable);
parse_ranges([{From, To}|Rest], Len, Acc)
when is_integer(To) andalso To >= Len ->