#1 Re: mORMot 2 » unit mormot.net.http.pas Methods: the function THttpRequestContext bug » 2024-01-30 04:45:50

//-- This works fine
ContentLength := FileSize(FileName);
  if ContentLength=0 then
  begin
    result := true;
    exit;
  end;
  result := ContentLength <> 0;
  if result and
     (rfWantRange in ResponseFlags) then
    if not ValidateRange then
      result := false; // invalid offset
  if not result then
    // there is no such file available, or range clearly wrong
    exit;
  include(ResponseFlags, rfAcceptRange);

#2 mORMot 2 » unit mormot.net.http.pas Methods: the function THttpRequestContext bug » 2024-01-28 13:54:59

wfbhappy
Replies: 2

Output a file as a file stream
2.Mormot2 BUG Fix Please fix this unit mormot.net.http.pas
Methods: the function THttpRequestContext. ContentFromFile Bug  reasons, the file is empty when the output is false, can not find a file, is wrong.
Amended as follows :
ContentLength := FileSize(FileName):// Add this judgment to this sentence:
if ContentLength=0 then
begin
result := true;

Board footer

Powered by FluxBB