Skip to content

Commit

Permalink
set range header on message downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Richman committed Mar 22, 2021
1 parent 33c4f60 commit dbc538c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions http.ml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ let get url ~interrupt ~range =
Async_multi_integration.initialise_once ();
let curl_easy = Curl.init () in
Curl.set_url curl_easy url;
(match range with
| `all_with_max_len _ -> ()
| `exactly_pos_len (pos, len) ->
let range_header = sprintf "Range: bytes=%i-%i" pos (pos + len - 1) in
Curl.set_httpheader curl_easy [ range_header ]);
let response_too_long_ivar = Ivar.create () in
Curl.set_writefunction curl_easy (fun s ->
(match Iobuf.Fill.stringo output_buffer s with
Expand Down

0 comments on commit dbc538c

Please sign in to comment.