#1 Re: mORMot 2 » RestHttpServer with https » 2024-11-21 20:06:26

Thank you for your answer
How can I do that with example please
Thank you

#2 Re: mORMot 2 » RestHttpServer with https » 2024-11-21 12:17:49

Good morning,
After using my certificate

  HttpServer := TRestHttpServer.Create([SampleServer], HttpPort, 16, secTLS,HTTPSERVER_DEFAULT_OPTIONS , 'mycertificat.pem','myprivatkey.key','PasseworD' );

I got the following error:

20241121 12060323  ! EXC           ESChannel {Message:"<>: AfterBind: PFXImportCertStore returned 80090327 [SEC_E_CERT_UNKNOWN], System Error -2146885630 [Une erreur s’est produite lors d’une opération de codage ou de décodage]"} [Main] at 4471b9 
20241121 12060324  ! EXC           ENetSock {Message:"TCrtSocket.DoTlsAfter: TLS failed [ESChannel <>: AfterBind: PFXImportCertStore returned 80090327 [SEC_E_CERT_UNKNOWN], System Error -2146885630 [Une erreur s’est produite lors d’une opération de codage ou de décodage]]"} [Main] at 44c7b9

#3 Re: mORMot 2 » RestHttpServer with https » 2024-11-21 08:23:14

Thanks for your help
i will test
Thanks

#4 Re: mORMot 2 » RestHttpServer with https » 2024-11-18 12:09:18

Thank you for your response.
How can I do it with my own certificate with example please
THANKS

#5 Re: mORMot 2 » RestHttpServer with https » 2024-11-16 20:17:47

Thank you for your response,
what is the best solution (security + speed) to resolve this problem,
with example if you like
THANKS

#6 mORMot 2 » RestHttpServer with https » 2024-11-16 17:47:41

hicham_taybi
Replies: 10

Good morning,
I am a beginner in Mormot,
I took the example:
mormot2\ex\Third Party Demos\martin-doyle\05-HttpDaemonORM,
and I added https, I changed:
On the server:

HttpServer := TRestHttpServer.Create(HttpPort,[SampleServer],'+',HTTP_DEFAULT_MODE,32,secTlsselfsigned );

On the client:

  HttpClient := TRestHttpClient.Create('localhost', HttpPort, Model,true);
  HttpClient.IgnoreTlsCertificateErrors:=true;

I ran Project05HttpDaemon.exe as administrator, it is registered in http.sys:

20241116 17291031  !  +         mormot.rest.http.server.TRestHttpServer(016738e0).Create useHttpApiRegisteringURI (secTLSSelfSigned) on port 11111
20241116 17291033  ! http               mormot.rest.http.server.TRestHttpServer(016738e0) http.sys registration of https://+:11111/root
20241116 17291033  " info  SetThreadName 4c84=HttpSrv 11111root THttpApiSrv
20241116 17291033  " trace server.TSampleServer(01600030) BeginCurrentThread(THttpApiServer) root=root ThreadID=4c84 'HttpSrv 11111root THttpApiSrv' ThreadCount=1
20241116 17291033  # info  SetThreadName 4f40=HttpSrv 11111root THttpApiSrv



But the client requests do not reach the server, there is not even a trace on the server.
THANKS.

#8 Re: mORMot 2 » open pdf files in browsers of client without downloading them » 2024-10-27 16:39:42

I have this code to download
function TExampleService.DownloadFile(const FileName: RawUTF8): RawByteString;
var
  FileStream: TFileStream;
begin
  try
    FileStream := TFileStream.Create(UTF8ToString(FileName), fmOpenRead or fmShareDenyNone);
    try
      SetLength(Result, FileStream.Size);
      FileStream.ReadBuffer(Pointer(Result)^, FileStream.Size);
    finally
      FileStream.Free;
    end;
  except
    Result := '';
  end;
end;

#9 Re: mORMot 2 » open pdf files in browsers of client without downloading them » 2024-10-27 16:36:31

Thank you for your answer,
I am a deputant in Mormot
How can I do this
Thank you

#10 mORMot 2 » open pdf files in browsers of client without downloading them » 2024-10-27 15:48:43

hicham_taybi
Replies: 5

Hello
How can I create a service with mormot2 to allow the client to open pdf files that are on the server in their browsers without downloading them.
Thank you

Board footer

Powered by FluxBB