Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

methodiHttpResponse.SendFileRange

function SendFileRange(const aPhysicalFile: string; const aRangeHeader: string): Integer;
SendFile honouring a Range header, reading ONLY the requested window.

Pass the request's Range header - aRequest.Headers.Value('Range') - or '' when there is none. Answers the status it set: 200 for no range, 206 with Content-Range for one, 416 with an empty body for a range that starts past the end, 404 for a file that is not there. Accept-Ranges accompanies all of them.

THIS IS THE ONE TO USE FOR ANYTHING LARGE: it sends from the file as SendFile does, and it also lets a client resume an interrupted download by asking for the rest.

aPhysicalFile IS OPENED BY NAME. For a source you already hold open - above all a stream from a verified stFileJail handle, which must not be re-resolved by path - use HttpSendStreamRange, which is the implementation this delegates to.