#1 Re: mORMot 2 » mormot.net.acme error » 2024-10-26 09:00:56

For example, if the certificate expired yesterday (cc.GetNotAfter), your code: Expired := NowUtc-fRenewBeforeEndDays; expired is one month ago, cc.getNotAfter<expired is not valid.

#2 Re: mORMot 2 » mormot.net.acme error » 2024-10-26 08:55:57

Am I wrong? How do I feel that your code will trigger renew after the expiration of rnewBeforeEndDays? My previous program has not triggered after the expiration, and I need to delete all certificate files each time before I can get it again.

#3 Re: mORMot 2 » mormot.net.acme error » 2024-10-26 04:32:26

In TAcmeLetsEncrypt checkCertificates procedure(line 1110), check the expiration date of error code:
  cc. GetNotAfter < expired
should be:
cc.getNotAfter-fRenewBeforeEndDays < NowUtc

#5 Re: mORMot 2 » how to add/change the username and password? » 2024-07-30 10:10:25

Several global variables are defined in the mormot.rest.core unit:AuthAdminDefaultPassword,AuthSupervisorDefaultPassword,AuthUserDefaultPassword。You can set the initial password, and then change the password through the server code

#6 Re: mORMot 2 » One small suggestion: Return values for interface-based services » 2024-07-08 01:34:22

Thank you for your great work!
  I read the source code and in the new method you added: in the InternalInvoke function of the mormot.soa.client unit, when the clientSideInvoked method is invoked in the DoClientCall method, should the parameter "send" be "resp"?

#7 Re: mORMot 2 » One small suggestion: Return values for interface-based services » 2024-07-05 10:07:12

By customizing the Routing class, I changed the format of the returned data to meet my requirements in the web client, but if the same interface needs to work in the pascal client, it should not be recognized correctly. Should there also be a corresponding method in the TRestClientRouting's inheritance class that can customize the data returned by parsing?

#8 Re: mORMot 2 » Where do I start? » 2024-07-04 01:00:44

Kabiri wrote:

I reviewed the mormot2 examples. In the examples, everyone uses the model. sad


Orm model can have no objects;

  TOrmModel.create([ ], arootName)

#9 Re: mORMot 2 » TDocVariantData.GetValueByPath and Arrays » 2024-04-29 01:31:51

Sorry, my mistake, my json file format is corrupted.

#10 Re: mORMot 2 » TDocVariantData.GetValueByPath and Arrays » 2024-04-28 10:26:58

Now IDocDict doesn't work correctly, use "exists" to check for existing keys and always return false

#11 Re: mORMot 2 » Output parameters of the RawUtf8 type are incorrectly displayed » 2023-11-11 00:57:13

不行,我看了返回值的16进制数字,原始字符串:out测试,  返回的16进制表示:6F7574 C3A6C2B5C28B C3A8C2AFC295,正确的UTF8编码:6F7574 E6B58B E8AF95

#12 Re: mORMot 2 » Output parameters of the RawUtf8 type are incorrectly displayed » 2023-11-10 06:32:53

I tried it, but using Utf8ToString(errMsg) didn't solve the problem.
What happens to the RawUtf8 parameter? English can be returned normally.

#13 mORMot 2 » Output parameters of the RawUtf8 type are incorrectly displayed » 2023-11-09 11:41:44

lfyey121
Replies: 4

my code define as follows::

  IUserManage = interface(IInvokable)
  ['{970EB610-FC4B-4A89-9A39-2767A5100F97}']
    function chgMyPwd(oldPwd,newPwd:RawUtf8;hashed:Boolean;out errMsg:RawUtf8):boolean;
  end; 

  If errmsg returns a Chinese string, the client displays it incorrectly, but if errmsg is of type string, the return is correct.

  I don't know why.

#14 Re: mORMot 2 » Failed to decompress the compressed file using GzFile. Procedure » 2023-10-28 07:25:39

When TSynZipDecompressor. Create (d, szcfRaw), the error is: (avail in = 131071 out = 131072)

#15 mORMot 2 » Failed to decompress the compressed file using GzFile. Procedure » 2023-10-28 07:21:06

lfyey121
Replies: 1

I used the following method to extract it,Error on line 880 of mormot.lib.z:Error -3[data error] during TsynZipDecompressor.write process(avail in =131070 out=131072)

function TmainForm.GUnZipFile(aSrcFile, aDestFile: TFileName; aIsFile: Boolean
  ): boolean;
var
  gz: TSynZipDeCompressor;
  s, d: TStream;
  vfn:TFileName;
begin
  try
    s := TFileStreamEx.Create(aSrcFile, fmOpenReadDenyNone);
    try
      if aIsFile then
        vfn:=aDestFile
      else
        vfn:=aDestFile+extractFileName(aSrcFile);
      d := TFileStreamEx.Create(vfn, fmCreate);
      try
        gz := TSynZipDeCompressor.Create(d,szcFzip{, szcfGZ});
        try
          StreamCopyUntilEnd(s, gz);
          result := true;
        finally
          gz.Free;
        end;
      finally
        d.Free;
      end;
    finally
      s.Free;
    end;
  except
    result := false;
  end;
end;

#16 Re: mORMot 2 » Is there a urlEncode/urlDecode function that implements RFC3986 » 2023-10-19 09:41:34

I find using TDocVariantData sortByName, and toUrlEncode can satisfy many platform API calls, if the toUrlEncode can choose encoding rules: use urlEncode or urlencodeName, so much the better

#17 mORMot 2 » Using tsyndaemon when running as a service is very cpu consuming » 2023-10-17 03:05:03

lfyey121
Replies: 0

The service I developed with TsynDaemon has a cpu usage close to zero when running with /c as the console, and 20% when running as a service. I don't know what the problem is, even though I don't have any code in start, the cpu usage is so high. My system is windows10 fpc3.3.1 lazarrus 3.99, mormot2

#18 Re: mORMot 2 » mormot.net.acme error » 2023-10-12 11:23:45

Thank you, https is finally working

#19 Re: mORMot 2 » mormot.net.acme error » 2023-10-12 11:21:51

After many attempts, the ssl_password_file parameter does the job, but strangely, the file name specified after this parameter must be in the standard windows path, and the certificate file specified path must replace the '\' in the path with '//'.

#20 Re: mORMot 2 » mormot.net.acme error » 2023-10-12 09:43:15

gAcmeLetsEncryptServer:=TAcmeLetsEncryptServer.create(TsynLog, TacmeDaemonSettings(settings).keyStoreFolder,
      ACME_LETSENCRYPT_URL{ACME_LETSENCRYPT_DEBUG_URL},'',''{There can be no passwords here},-1,'8084');

#21 Re: mORMot 2 » mormot.net.acme error » 2023-10-12 09:40:56

After the test, you cannot set the password when applying for a certificate. After the password is set, the https service cannot run. After removing the password and re-applying for a certificate, it can run normally

#22 Re: mORMot 2 » mormot.net.acme error » 2023-10-11 12:52:13

d:\sslkeystore\xxx.xx.com.crt.pem;
d:\sslkeystore\xxx.xx.com.crt.pem;

This is the file generated by mormot.net.acme

#23 Re: mORMot 2 » mormot.net.acme error » 2023-10-11 12:48:50

I use nginx, the Settings are as follows, but https is not accessible,, I don't know what the problem is

server {
        listen       443 ssl;
        server_name  xxx.xx.com;
        ssl_certificate      d://sslkeystore//xxx.xx.com.crt.pem;
        ssl_certificate_key  d://sslkeystore//xxx.xx.com.key.pem;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
       

        location / {
            proxy_pass   http://127.0.0.1:81;
            proxy_redirect     default;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
            proxy_max_temp_file_size 0;
            proxy_connect_timeout      180;
            proxy_send_timeout         180;
            proxy_read_timeout         180;
            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;
        }
    }

#24 Re: mORMot 2 » mormot.net.acme error » 2023-10-11 01:07:01

Yes, it works correctly and the certificate file has been generated

thanks

#25 Re: mORMot 2 » CompareMem function problem » 2023-10-08 03:20:50

Thanks
this issue has been solved,
but this mormot.net.acme has found a new issue here, I have submitted a new topic

#26 mORMot 2 » mormot.net.acme error » 2023-10-08 03:14:29

lfyey121
Replies: 17

An error occurred while calling the completedomainregistero function:

   EXC   EJwsHttp {Message:"Error 400 [Error parsing certificate request: asn1: structure error: tags don't match (16 vs {class:0 tag:13 length:45 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} certificateRequest @2] while querying https://acme-v02.api.letsencrypt.org/acme/finalize/1349321746/213579860876"} [CheckCertificates] at 4c4526

#27 Re: mORMot 2 » CompareMem function problem » 2023-10-07 12:45:00

I trace that in asm code, the comparison of the first 4 bytes is already inconsistent

#28 Re: mORMot 2 » CompareMem function problem » 2023-10-07 12:28:06

The received data url:

  /.well-known/acme-challenge/Fx3W3J_cIlgHswjpA_NMDES4GPJ0acGEBHtXaCgTlsM

#29 mORMot 2 » CompareMem function problem » 2023-10-07 12:22:17

lfyey121
Replies: 4

In line 1264 of the mormot.net.acme unit, CompareMem(P, @_ACME_CHALLENGE_PATH, ACME_CHALLENGE_PATH_LEN) executes incorrectly and returns false all the time.

My environment is lazarus 3.99, FPC3.3.1(i386), windows 10

#30 Re: mORMot 2 » mormot2tests fails to compile when the option USE_OPENSSL is set » 2023-09-12 09:55:13

Thank you for your quick response.

The program is running normally.

Thank you again for your contributions to the world of pascal

#31 Re: mORMot 2 » mormot2tests fails to compile when the option USE_OPENSSL is set » 2023-09-12 08:24:01

this is my code:
  registerOpenSsl;
  gAcmeLetsEncryptServer:=TAcmeLetsEncryptServer.create(TsynLog, TacmeDaemonSettings(settings).keyStoreFolder,
      ACME_LETSENCRYPT_URL,'','abcdefg',-1,'8084');
  gAcmeLetsEncryptServer.LoadFromKeyStoreFolder;
  gAcmeLetsEncryptServer.Redirect('xxxx.com','https://www.xxxx.com');
  gAcmeLetsEncryptServer.Redirect('www.xxxx.com','https://www.xxxx.com');   

the “AcmeLetsEncryptServer.Redirect ” has an error at runtime:
  Project acmeDaemon raised exception class 'External:ACCESS VIOLATION' with message:Access violation reading from address $7331322D.
  in file 'mormot.core.base.pas' at line 4819:if PStrLen(p1-_STRLEN)^=len then

This error is in the execution TAcmeLetsEncrypt. GetClient statements,

#32 Re: mORMot 2 » mormot2tests fails to compile when the option USE_OPENSSL is set » 2023-09-12 02:27:03

Error is in the call:
  AcmeLetsEncryptServer. Redirect (' xxxx.com ', 'https://www.xxxx.com');

#33 Re: mORMot 2 » mormot2tests fails to compile when the option USE_OPENSSL is set » 2023-09-12 02:18:59

After introducing the mormot.crypt.openssl unit and calling registerOpenSsl, the issue of x509-es256 not being supported was resolved. But a memory conflict occurred again. When I traced the call to the getClient part of the getClientLocked method in mormot.net.acme, the value of the servername parameter passed changed to an invalid string, causing an error when the FindPropName method was called.

#34 Re: mORMot 2 » mormot2tests fails to compile when the option USE_OPENSSL is set » 2023-09-11 12:32:22

I'm testing this because I got a run-time error when I was using mormot.net.acme saying that X509-es256 is not supported, and acme relies on openssl, so I'm testing to see if openssl has errors

#35 Re: mORMot 2 » mormot2tests fails to compile when the option USE_OPENSSL is set » 2023-09-11 12:23:27

Is my problem, add compile parameter -dUSE_OPENSSL; FORCE_OPENSSL, needs to be recompiled, I am running directly.

#36 mORMot 2 » mormot2tests fails to compile when the option USE_OPENSSL is set » 2023-09-10 12:23:13

lfyey121
Replies: 10

mormot2tests project, when setting the compilation option USE_OPENSSL; FORCE_OPENSSL, the project could not compile, indicating that many open_SSL-related variables could not be found.


FPC 3.2.2 ,lazarus 2.2.6

FPC 3.3.1,lazarus 3.99

I've tested the above versions and they don't work.

Also, I found that lazarus.lpk does not contain the file mormot.crypt.x509

#37 Re: mORMot 2 » Collections.newKeyValue<RawUtf8,variant>() prompting syntax errors » 2023-07-31 13:15:47

Thank you. Yes, you're right. It's up and running.

I want to sort the elements of IKeyValue by Key, and I don't know any good way to do that.

#38 mORMot 2 » Collections.newKeyValue<RawUtf8,variant>() prompting syntax errors » 2023-07-30 13:51:44

lfyey121
Replies: 3

FPC 3.2.2  lazarus2.2.6

Use the class IkeyValue in mormot.core.collections

The following code keeps getting errors:  Fatal: Syntax error, ";" expected but "," found.

  vparams:specialize IkeyValue<RawUtf8,variant>;

  vParams:=Collections.NewPlainKeyValue<RawUtf8, variant>();    //There are errors in this line

#40 Re: mORMot 2 » Is there a urlEncode/urlDecode function that implements RFC3986 » 2023-07-29 09:03:26

The encoded URI is transmitted, but a signature field is added, and the signature field is based on this encoded URI. The result is definitely different if the string contains ~ and %7E

#41 Re: mORMot 2 » Is there a urlEncode/urlDecode function that implements RFC3986 » 2023-07-29 07:44:01

api calls from ali,tencent, or other services will sign the encoded url. If the encoding results are inconsistent, the signature verification will fail

#42 Re: mORMot 2 » Is there a urlEncode/urlDecode function that implements RFC3986 » 2023-07-29 07:29:53

or You can add an argument to the urlencode(urlEncodeName) function, and it is up to the user to decide whether ~ is encoded or not

#43 Re: mORMot 2 » Is there a urlEncode/urlDecode function that implements RFC3986 » 2023-07-29 04:07:31

RFC3986 rules will not encode ~, PHP rawUrlEncode from version 5.3 support RFC3986, the previous version will encode ~, Ali, Tencent api coding is to follow this rule.

#45 Re: mORMot 2 » Is there a urlEncode/urlDecode function that implements RFC3986 » 2023-07-29 01:59:33

Thanks for your quick response, but shouldn't the space2plus argument for calling _UrlEncode_ComputeLen in urlencodeName be 48('0')? Should it be 43('+').

#46 mORMot 2 » Is there a urlEncode/urlDecode function that implements RFC3986 » 2023-07-28 09:46:36

lfyey121
Replies: 13

url encoding in RFC3986 is different from urlEncode in mormot.core.buffers. Spaces cannot be replaced with +

#47 Re: mORMot 2 » One small suggestion: Return values for interface-based services » 2023-07-24 06:59:16

My English is poor, most of these contents are written with the help of translation software, some descriptions may not be accurate, which will cause trouble to you.

#48 Re: mORMot 2 » One small suggestion: Return values for interface-based services » 2023-07-24 06:55:38

At your prompt, I read the source code TrestServerUriContext in detail, and it is indeed possible to override ServiceResultStart and ServiceResultEnd requirements through inherited classes.

Thanks again for the tip.

#49 Re: mORMot 2 » One small suggestion: Return values for interface-based services » 2023-07-24 01:50:14

Thank you for your reply.
This is done using method-based services, which do not take advantage of the convenience of interface-based services. Or, in an interface-based service, how do you get the output parameters to be written in such a format?

#50 mORMot 2 » One small suggestion: Return values for interface-based services » 2023-07-23 08:55:01

lfyey121
Replies: 9

In mormot, when the interface-based method returns a value via TrestServerUriContext, can it be wrapped in json format like :
{
  code:errcode,
  msg:'errmsg',
  data/(result):{...  } or [... ]
},
Most Rest servers currently communicate with js clients in a format similar to this

Board footer

Powered by FluxBB