Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by mytbo

  1. You wrote a long text but probably didn't spend a second to follow my links. If you did, what are you missing? I'm happy to take suggestions for further articles. With best regards Thomas
  2. If you want to use mORMot for the implementation, you can find some suggestions in these articles with sourcecode. For the creation of a MVC Web Application you can find an example here. If you use the ORM, the update is done by calling function CreateMissingTables. With best regards Thomas
  3. mytbo

    FTP download file

    I can't answer your question for ICS. I use Curl because it supports FTP/FTPS/SFTP. You can find all the information on how to use it in this forum thread. An example of a download function: function FTPDownloadFile(const pmcUrl, pmcUserName, pmcPassword: RawUtf8; var pmvContent: RawByteString): TCurlResult; var hnd: TCurl; begin Result := crFailedInit; if not CurlIsAvailable then Exit; //=> hnd := curl.easy_init; if hnd <> Nil then begin curl.easy_setopt(hnd, coURL, Pointer(pmcUrl)); curl.easy_setopt(hnd, coUserName, Pointer(pmcUserName)); curl.easy_setopt(hnd, coPassword, Pointer(pmcPassword)); curl.easy_setopt(hnd, coWriteFunction, @CurlWriteRawByteString); curl.easy_setopt(hnd, coWriteData, @pmvContent); Result := curl.easy_perform(hnd); if Result <> crOk then pmvContent := ''; curl.easy_cleanup(hnd); end; end; Use it like this (for an SFTP server): uses mormot.core.base, mormot.core.text, mormot.core.os, mormot.lib.curl; var url: RawUtf8; buffer: RawByteString; begin url := 'sftp://test.rebex.net:22/pub/example/readme.txt'; if FTPDownloadFile(url, 'demo', 'password', buffer) = crOk then begin FileFromString(buffer, MakePath([Executable.ProgramFilePath, 'readme.txt'])); ShowMessage(Format('Download completed: %s', [KB(Length(buffer))])); end; end; With best regards Thomas
  4. mytbo

    Enable protocol TLS 1.3 on Windows 7

    No, you are using the wrong libcurl DLL. Please download the file only from the official site and do not use any other source. Here is the link to the Windows download. The file for curl for 32-bit has the name curl-7.87.0_4-win32-mingw.zip and SHA256: ef8730e31245ef138aba1e3f02ae02e3fce435ec89177d7c8b05de5ce3c07891. The libcurl DLL has the modification date: Wednesday, December 21, 2022, 07:05:38. File size is 4,405,320 bytes. With best regards Thomas
  5. mytbo

    Enable protocol TLS 1.3 on Windows 7

    Your libcurl DLL version is out of date (12-Oct-16). Download the latest version for your OS from the official site. With best regards Thomas
  6. mytbo

    Enable protocol TLS 1.3 on Windows 7

    The all-purpose solution is Curl. The curl.exe program is part of current Windows versions. Links: GitHub, Download, Manual, libcurl C API and libcurl C examples. An encapsulation for libcurl DLL can be found in the mORMot unit mormot.lib.curl. The mORMot library does not need to be installed. Download the current commit and the static binaries from the last tag directory. Set the appropriate library and search paths in Delphi. This pattern helps to create them: // Simply replace the colons with the save path ..\src;..\src\app;..\src\core;..\src\crypt;..\src\db;..\src\lib;..\src\misc;..\src\net;..\src\orm;..\src\rest;..\src\script;..\src\soa;..\src\tools\ecc;..\src\ui; For many use cases you can find a template in the libcurl C examples. The following Delphi example shows the implementation for a download: uses mormot.core.base, mormot.core.text, mormot.core.os, mormot.lib.curl; var hnd: TCurl; url: RawUtf8; res: TCurlResult; buffer: RawByteString; responseSize: Int64; begin if not CurlIsAvailable then Exit; //=> hnd := curl.easy_init; if hnd <> Nil then begin url := 'https://icons8.com/icons/set/home.html'; curl.easy_setopt(hnd, coURL, Pointer(url)); curl.easy_setopt(hnd, coSSLVerifyPeer, 0); curl.easy_setopt(hnd, coSSLVerifyHost, 0); curl.easy_setopt(hnd, coWriteFunction, @CurlWriteRawByteString); curl.easy_setopt(hnd, coWriteData, @buffer); res := curl.easy_perform(hnd); if res = crOk then begin FileFromString(buffer, MakePath([Executable.ProgramFilePath, 'home.html'])); curl.easy_getinfo(hnd, ciSizeDownloadT, responseSize); ShowMessage(Format('Download completed: %s', [KB(responseSize)])); end else ShowMessage(Format('Curl told us %d (%s)', [Ord(res), curl.easy_strerror(res)])); curl.easy_cleanup(hnd); end; end; An example to study is also the class TCurlHttp from the unit mormot.net.client. With best regards Thomas
  7. mytbo

    Json create Array

    With mORMot you can write it as follows: ShowMessage(Utf8ToString(VariantSaveJson( _Obj(['registration_ids', _Arr(['crX7c-...']), 'notification', _Obj(['title', 'Hi', 'body', 'Notification test'])])))); The function _Obj() uses name-value pairs. The description of _Obj() can be found in the help here and for _Arr() here. Information about TDocVariant documents can be found here. With best regards Thomas