Skip to content

Commit

Permalink
Merge pull request #87 from pmundkur/fix-zero-length-range-response
Browse files Browse the repository at this point in the history
Fix 0-length range responses.
  • Loading branch information
etrepum committed Aug 1, 2013
2 parents 4b77ea0 + 526ce73 commit 510766b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mochiweb_request.erl
Expand Up @@ -672,7 +672,12 @@ range_parts({file, IoDevice}, Ranges) ->
LocNums = lists:foldr(F, [], Ranges),
{ok, Data} = file:pread(IoDevice, LocNums),
Bodies = lists:zipwith(fun ({Skip, Length}, PartialBody) ->
{Skip, Skip + Length - 1, PartialBody}
case Length of
0 ->
{Skip, Skip, <<>>};
_ ->
{Skip, Skip + Length - 1, PartialBody}
end
end,
LocNums, Data),
{Bodies, Size};
Expand Down

0 comments on commit 510766b

Please sign in to comment.