Skip to content

Commit

Permalink
Fix range parsing regression introduced in #147
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed Jan 16, 2015
1 parent 4c368d4 commit 7adccd9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mochiweb.app.src
Original file line number Diff line number Diff line change
@@ -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, []},
Expand Down
8 changes: 3 additions & 5 deletions src/mochiweb_http.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 7adccd9

Please sign in to comment.