1. Basho
  2. Untitled project
  3. luwak

Commits

Bryan Fink  committed 149af34

add the bytes-unit specifier to the Range headers (bz://487)

  • Participants
  • Parent commits da8a864
  • Branches default

Comments (0)

Files changed (1)

File src/luwak_wm_file.erl

View file
     case wrq:get_req_header(?HEAD_RANGE, RD) of
         undefined ->
             {ok, []};
-        RawHeader ->
+        "bytes="++RawHeader ->
             RawRanges = string:tokens(RawHeader, ", "),
             Parsed = [ {catch parse_range(R), R} || R <- RawRanges ],
             case [ R || {{'EXIT',_}, R} <- Parsed ] of
                     {ok, [ P || {P, _} <- Parsed ]};
                 Errors ->
                     {error, Errors}
-            end
+            end;
+        Invalid ->
+            {error, [Invalid]}
     end.
 
 parse_range([$-|R]) ->
     end.
 
 content_range_header(Start, End, Length) ->
-    io_lib:format("~b-~b/~b", [Start, Start+End-1, Length]).
+    io_lib:format("bytes=~b-~b/~b", [Start, Start+End-1, Length]).
 
 send_file(Client, Handle, Start, End) ->
     Stream = luwak_get_stream:start(Client, Handle, Start, End),