#1 2014-02-26 06:29:52

VLT
Member
Registered: 2014-02-19
Posts: 2

Load file failed (fill by zero)

in SynCrtSock (in procedure THttpServer.Process(ClientSock: THttpServerSocket; aCallingThread: TNotifiedThread);)

      try
        FileToSend := TFileStream.Create(
          {$ifdef UNICODE}UTF8ToUnicodeString{$else}Utf8ToAnsi{$endif}(Context.OutContent),
          fmOpenRead or fmShareDenyNone);
        try
          SetString(Context.fOutContent,nil,FileToSend.Size);
          FileToSend.Position := 0;
          FileToSend.Read(Pointer(Context.fOutContent),length(Context.fOutContent)); // THIS PROBLEM !!! 
          Context.OutContentType := '';
       finally
          FileToSend.Free;
        end;
      except
        on Exception do begin
         Code := 404;
         Context.OutContent := '';
        end;
      end;
      try
        FileToSend := TFileStream.Create(
          {$ifdef UNICODE}UTF8ToUnicodeString{$else}Utf8ToAnsi{$endif}(Context.OutContent),
          fmOpenRead or fmShareDenyNone);
        try
          SetString(Context.fOutContent,nil,FileToSend.Size);
          FileToSend.Position := 0;
          FileToSend.Read(PAnsiChar(Context.fOutContent)^,length(Context.fOutContent)); // WORKED !!! 
          Context.OutContentType := '';
       finally
          FileToSend.Free;
        end;
      except
        on Exception do begin
         Code := 404;
         Context.OutContent := '';
        end;
      end;

Last edited by VLT (2014-02-26 06:30:18)

Offline

#2 2014-02-26 14:49:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Load file failed (fill by zero)

Oups...

Should be fixed by http://synopse.info/fossil/info/7ed5734831

Offline

Board footer

Powered by FluxBB