Fix range parsing regression introduced in #147
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/7adccd95 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/7adccd95 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/7adccd95 Branch: refs/heads/upstream Commit: 7adccd95b2be0f0832c71258ccbf20a3ad9663ce Parents: 4c368d4 Author: Bob Ippolito <[email protected]> Authored: Fri Jan 16 15:52:50 2015 -0800 Committer: Bob Ippolito <[email protected]> Committed: Fri Jan 16 15:52:50 2015 -0800 ---------------------------------------------------------------------- CHANGES.md | 5 +++++ src/mochiweb.app.src | 2 +- src/mochiweb_http.erl | 8 +++----- 3 files changed, 9 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/7adccd95/CHANGES.md ---------------------------------------------------------------------- diff --git a/CHANGES.md b/CHANGES.md index b134182..b591a43 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +Version 2.11.2 released 2015-01-16 + +* Fix regression introduced in #147 + https://github.com/mochi/mochiweb/pull/147 + Version 2.11.1 released 2015-01-16 * Accept range end position which exceededs the resource size http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/7adccd95/src/mochiweb.app.src ---------------------------------------------------------------------- diff --git a/src/mochiweb.app.src b/src/mochiweb.app.src index bb4f4af..97fc90d 100644 --- a/src/mochiweb.app.src +++ b/src/mochiweb.app.src @@ -1,7 +1,7 @@ %% This is generated from src/mochiweb.app.src {application, mochiweb, [{description, "MochiMedia Web Server"}, - {vsn, "2.11.1"}, + {vsn, "2.11.2"}, {modules, []}, {registered, []}, {env, []}, http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/7adccd95/src/mochiweb_http.erl ---------------------------------------------------------------------- diff --git a/src/mochiweb_http.erl b/src/mochiweb_http.erl index 271531b..1ea1f15 100644 --- a/src/mochiweb_http.erl +++ b/src/mochiweb_http.erl @@ -184,11 +184,9 @@ range_skip_length(Spec, Size) -> {R, Size - R}; {_OutOfRange, none} -> invalid_range; - {Start, End} when 0 =< Start, Start < Size, Start =< End -> - {Start, End - Start + 1}; - {Start, End} when 0 =< Start, Start =< End, End >= Size -> - {Start, Size - Start}; - {_OutOfRange, _End} -> + {Start, End} when Start >= 0, Start < Size, Start =< End -> + {Start, erlang:min(End + 1, Size) - Start}; + {_InvalidStart, _InvalidEnd} -> invalid_range end.
