From dbc538c1cdb693d8da1dc8fc7a9eb5712637fcf0 Mon Sep 17 00:00:00 2001 From: Daniel Richman Date: Mon, 22 Mar 2021 00:05:51 +0000 Subject: [PATCH] set range header on message downloads --- http.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/http.ml b/http.ml index 0e07202..be446dc 100644 --- a/http.ml +++ b/http.ml @@ -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