xorpas 4 Posted February 5, 2023 Hello I need to get html with tnethttpclient from site that use a latest versions of the Transport Layer Security (TLS 1.3) this site icons8 I modify the registry but not work How can do it on windows 7 ? or if their other way to get html; Share this post Link to post
mjustin 23 Posted February 5, 2023 (edited) See: https://stackoverflow.com/questions/72636489/tls-1-3-for-net-4-0-under-windows-7#comment128310433_72636489 Quote "Windows 7 doesn't support TLS1.3, end-of. (...) If you want to use a supported version of Windows which has the latest security improvements then upgrade. Win7 is completely out of support now (...) Edited February 5, 2023 by mjustin 2 Share this post Link to post
mjustin 23 Posted February 5, 2023 Other way would be for example cURL, or Indy / Synapse / mORMot. 2 Share this post Link to post
mytbo 5 Posted February 5, 2023 (edited) 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 Edited February 5, 2023 by mytbo 1 Share this post Link to post
xorpas 4 Posted February 6, 2023 On 2/5/2023 at 9:02 PM, mytbo said: 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 Thank's Mr thomas Not work for me see this image can you upload the work project to test it Share this post Link to post
Rollo62 538 Posted February 6, 2023 Not sure if that helps with your DLL issue, but are you aware that Curl already might be installed ? https://stackoverflow.com/questions/9507353/how-do-i-install-and-use-curl-on-windows Maybe you can make use of the system one. 1 Share this post Link to post
Guest Posted February 6, 2023 The version of libcurl.dll may be different, function exports may be missing in the dll, you can try with different dll versions. Is the dll version compiled for x32 or x64, Is your application compiled for x32 or x64 on windows, review them too. Share this post Link to post
Remy Lebeau 1428 Posted February 6, 2023 21 hours ago, mytbo said: The all-purpose solution is Curl. The curl.exe program is part of current Windows versions. By default, (lib)curl uses OpenSSL for SSL/TLS. Guess what else uses OpenSSL by default? Indy, which is pre-installed in Delphi. 2 Share this post Link to post
mytbo 5 Posted February 6, 2023 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 1 Share this post Link to post
xorpas 4 Posted February 7, 2023 On 2/6/2023 at 7:05 PM, mytbo said: 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 I download a latest version but the same problem Please upload a work project to test it Share this post Link to post
mytbo 5 Posted February 7, 2023 1 hour ago, xorpas said: I download a latest version but the same problem 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 2 Share this post Link to post
xorpas 4 Posted February 8, 2023 On 2/7/2023 at 6:40 PM, mytbo said: 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 byt With best regards Thomas Thank you mr Thomas It work now thank's for your time Share this post Link to post