File locked

Hello

I migrated my server from TRoIndyHttpServer to TROHttpServer.

One of my routines sends a file from the client to the server.

I receive authenticated PDF files and in the properties of that file comes the warning:

“This file came from another computer and can be blocked to help protect this computer.”

On the TRoIndyHttpServer server, the copy was made to the server without problems. Now for TROHttpServer it does not copy and generates the error: Error sending data.

Below is the code I run for copying.

[ROServiceMethod]
procedure TFaturamento.GetArquivo(sDiretorioArquivos, sNome, sDescricao,
  sUsuario: String; Arquivo: Binary; var ID: Integer);
var
qry: TFDQuery;
xNome, xNomeUtilizado, xSQL: String;
xTamanho: Integer;
begin
  // verifica se o diretório foi informado, se o mesmo não foi retorna o id como "0"
  // para que no Sispetro seja mostrada a mensagegem de que o diretorio não foi
  // configurado.
  if sDiretorioArquivos = '' then begin
    ID := 0;
    exit;
  end;

  xNome := GetNomeArquivo(sNome, sDiretorioArquivos);
  
  xNomeUtilizado:= GetNomeArquivo(sNome, sDiretorioArquivos);

  qry := TFDQuery.Create(nil);
  try
    Arquivo.SaveToFile(sDiretorioArquivos + '\' + xNomeUtilizado);
    xTamanho := Arquivo.Size;

Hi,

can you create a simple testcase that reproduce this error, pls?

is it error is reproduced with specific file or with any file, like C:\Windows\notepad.exe ?

Hi EvgenyK,

Below is an example based on one of your projects.

Please save this project in the C:\RemObjectsCopy folder

On the server side and client side, activate Indy, click on Button1 and select the file C:\RemObjectsCopy\licência fepam.pdf

The server will save a copy of this file in the C:\RemObjectsCopy folder with the name mytest.pdf

Now if you do the same procedure using the server and client with HTTP Server, you will see that an error will be generated and the file will not be copied.

If you take another *.pdf file, the copy will be made.

The problem is these PDFs that Windows has marked as a security flaw.

Thanks

RemObjectsCopy.rar (2.57 MB)

Hi,

This is limitation of TROHttpServer.
By default, it has limit in 2MB for incoming data.

You can remove it in runtime like

  ROHTTPServer.Server.MaxPostData := 10*1024*1024; //<<<<<
  ROHTTPServer.Active := ROHTTPServer.Active xor true;

I’ll increase this limit to 10MB and add this property to TROHttpServer directly so it can be changed via Object Ispector

Logged as bugs://D19444.

bugs://D19444 was closed as fixed.