PizzaProgram 9 Posted October 3, 2023 (edited) Please advice me where I could find a "simple download" example of ICS v8.70 ? I'm still using Delphi7, so I was told it is not recommended to update to the new 9.0 version. With Indy10 it was extremely simple to do: IdHTTP1.ConnectTimeout := 2000; try FS := TFileStream.Create(save_path, fmCreate); except Exit; end; try //'http://...' IdHTTP1.Get(theURL , FS); if IdHTTP1.ResponseCode = 200 then ... ... Also I was able to update the request status + the progress: function get_httpStatus(const AStatus: TIdStatus; const AStatusText: String): string; var s: string; begin case AStatus of hsResolving : s := 'Webszerver (DNS) keresése...'; hsConnecting : s := 'Kapcsolódás a webre...'; hsConnected : s := 'A kapcsolódás sikeres.'; hsDisconnecting : s := 'A kapcsolat bontása'; hsDisconnected : s := 'A kapcsolat BONTVA.'; hsStatusText : s := 'Állapot:'+AStatusText; ftpTransfer : s := 'Adatáttöltés...(FTP)'; ftpReady : s := 'Készen áll az adattöltésre (FTP)'; ftpAborted : s := ' ! MEGSZAKÍTVA !'; end; Result := s; end; procedure TFrm_myDownload.IdHTTP1Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String); begin lbl_status.Caption := get_httpStatus(AStatus, AStatusText); lbl_status.Repaint; end; So how do I do the same with ICS? - need timeout - need progress update (not the ICS progress bar, but my own) - need status update (localized!) PS: I've spent ca. 30 hours so far reading FAQ + Getting Started + opening and analysing the examples inside ..\ICS\Samples\Delphi directory, but found nothing, except: - the "OverbyteIcsHttpMultipartDownload.dpr", which ended up with catastrophe: PS2.: [edit] Also used "search" on this page with multiple keywords, checking 200+ topics, but found no answer. Edited October 3, 2023 by PizzaProgram Share this post Link to post
Angus Robertson 577 Posted October 3, 2023 (edited) ICS v9.0 has been tested on Delphi 7, and future versions may still work on Delphi 7 but will not be tested or supported, I can not justify my unpaid time to support 20 year old tools that lack language features in Delphi 2007. From the ICS readme file about client samples: OverbyteIcsXferTst - File copying, FTP upload and download, HTTP download, using TIcsFileCopy, TIcsFtpMulti and TIcsHttpMulti This sample downloads multiple HTTP files with progress display and logging, I wrote it almost 20 years ago. There is also a very simple example in the new OverbyteIcsSnippets sample, function doHttpDownListClick that downloads three files with progress information, only 50 lines of code with a single function call HttpMultiClient.Download. Angus Edited October 3, 2023 by Angus Robertson 1 Share this post Link to post
PizzaProgram 9 Posted October 13, 2023 Sorry, need a bit more help, because it's not working as I've expected. (Still trying to solve it with ICS v8.70 yet.) The first step for this component to work, to download the necessary 3 files of SSL3 DLLs, so it can communicate with TLS1.3 servers via httpS . I've uploaded those files to my own http:// (no SSL!) server. But TIcsHttpMulti.Download() can not start, because it gives the error: Project ....exe raised exception class EIcsLibeayException with message 'Failed to load OpenSSL file libcrypto-1_1.dll'. Process stopped. Is it possible that ICS can not work without extra DLLs at all? Not even communicating with simple non-SSL http:// servers using the OS's built-in dll? (Only worked until now, because I've downloaded those DLLs with an Indy10 component, but now I've tried to update this part of my code to replace Indy everywhere.) Share this post Link to post
FPiette 385 Posted October 13, 2023 43 minutes ago, PizzaProgram said: Is it possible that ICS can not work without extra DLLs at all? Not even communicating with simple non-SSL http:// servers using the OS's built-in dll? If you don't need SSL, your don't need OpenSSL DLL. But, you have to tell ICS to compile without SSL code and that is done by undefining USE_SSL. You'll find this define in source/include/OverbyteIcsDefs.inc just comment out the line and recompile EVERYTHING. Share this post Link to post
PizzaProgram 9 Posted October 13, 2023 Yes, I NEED SSL, that's why I'm trying to download the necessary SSL DLLs first (from a non-SSL server). So it seems to me it's a 22's trap. Without those DLLs ICS is not working at all, but to download them, I need those DLLs first. Share this post Link to post
Angus Robertson 577 Posted October 13, 2023 You don't download OpenSSL using ICS, you use a normal browser. But you already have OpenSSL, it is also distributed as part of ICS, in the openssl folder, and the DLLs are also in the sslsamples folder so all the ICS samples work. You just have to make sure the DLLs are in the same folder as your exe, unless you specify a different folder in code. Angus Share this post Link to post
PizzaProgram 9 Posted October 13, 2023 52 minutes ago, Angus Robertson said: You don't download OpenSSL using ICS, you use a normal browser. No, it is impossible to do this manually on hundreds of PCs one by one. My EXE is auto-updating itself, no user action is necessary. If the new EXE needs some extra/updated DLLs, it must download them automatically and put them in the right subdirectory. Until now, Indy10 component did this completely automated. It has a simple way to check if http:// or https:// is necessary, and if no SSL is needed, it can work "alone" without any necessary extra DLLs. I was trying to get rid of Indy, (because it is 10+ years old and has some memory leaks,) and rewrite the whole auto-download system based on ICS. But it seems to be impossible. 😞 Share this post Link to post
FPiette 385 Posted October 13, 2023 24 minutes ago, PizzaProgram said: But it seems to be impossible. Look better. And explain clearly what problem you have! Up to know you are very confusing. Sometimes you want SSL and sometimes you don't. That's not a problem at all if this is for different applications. Did you see my previous reply mentioning USE_SSL define? Share this post Link to post
FPiette 385 Posted October 13, 2023 3 hours ago, PizzaProgram said: Yes, I NEED SSL, that's why I'm trying to download the necessary SSL DLLs first (from a non-SSL server). Without those DLLs ICS is not working at all, but to download them, I need those DLLs first. How do you distribute/deploy your application? Why don't you deploy all dependencies along with the executable? Think about a setup program. Using a setup application (There are plenty) or write one yourself using Delphi. You can also embed the OpenSSL into your executable and extract it on the first run. As long as you don't request any SSL related function, OpenSSL will no be required (ICS use dynamic load). Share this post Link to post
PizzaProgram 9 Posted October 13, 2023 3 minutes ago, FPiette said: Did you see my previous reply mentioning USE_SSL define? Of course I did ! Also I have replied to it. I don't know how to explain it better: 1. I have and EXE on hundreds of PCs, that needs to communicate with both http and https endpoints. 2. ICS can not start, because some necessary SSL DLLs are missing. 3. ICS is trying to download those DLLs from a non-SSL server via http://... , but can not !!! 4. GOTO: #2. Share this post Link to post
Angus Robertson 577 Posted October 13, 2023 > ICS can not start, because some necessary SSL DLLs are missing. Because you failed to distribute all the required files with your prorgram. > ICS is trying to download those DLLs from a non-SSL server via http://... , but can not !!! Because you told the ICS application you designed to do an impossible download. Bad program design. Before distributing applications to hundreds of PCs, I find a little testing helps. Angus Share this post Link to post
PizzaProgram 9 Posted October 13, 2023 1 minute ago, FPiette said: How do you distribute/deploy your application? Why don't you deploy all dependencies along with the executable? They are already distributed everywhere all over the country. Some of them 3, 5, 10+ years ago !!!!!!!!!! Also there are "ready to use" windows-backup image files that contain all necessary setup and the windows itself, without those DLL we are missing now. 5 minutes ago, FPiette said: Think about a setup program. Using a setup application (There are plenty) or write one yourself using Delphi. It is already built-into my own exe. But my Exe needs to DOWNLOAD automatically the necessary "setup updater" ! 9 minutes ago, FPiette said: You can also embed the OpenSSL into your executable and extract it on the first run. Normally that would be a great idea, but it would increase the 7MB exe file to double size. Some regions have 20-50Kbit internet only and it's already taking 2+ minutes! to download that 7MB. I worked very very hard for years to keep it that small, while the "whole program" with all the pictures and DLLs and everything else is 150MB, which is normally "static data", so only the 7MB needs to be downloaded, sometimes daily. Share this post Link to post
PizzaProgram 9 Posted October 13, 2023 Sorry for disturbing You guys, just forget about my question, I'll stay with Indy, it works as expected, and Indy will keep downloading the DLLs for ICS, where TLS 1.3 is needed. Thanks for trying to help ! Bye. Share this post Link to post
FPiette 385 Posted October 13, 2023 47 minutes ago, PizzaProgram said: ICS can not start, because some necessary SSL DLLs are missing. You are wrong there. Your application can't start. And most ICS sample do load OpenSSL automatically at startup. Here how to stop loading OpenSSL before really needed: 1) Take OverbyteIcsHttpsTest.dproj sample program. 2) Locate THttpsTstForm.FormShow event handle in OverbyteIcsHttpsTst1.pas source code. 3) At the end of that handler, you'll find this code: OverbyteIcsWSocket.LoadSsl; 4) Comment out form that line (including it) to the end of the event hanlder. Recompile, copy the exe to a folder when OpenSSL is not there. Run the executable. It starts nicely. Enter an http URL (not https) and click "Get" button. You'll see the document downloaded. Enter a https URL and click "Get" button. This time you should get an error because OpenSSL DLL are not found. Copy OpenSSL and retry. Https link will work. Using ProcessMonitor you can see when the OpenSSL are loaded. I hope you understand I demonstrated the ICS application can start without OpenSSL DLL present and the SAME application can do https once the DLL are in place. 1 Share this post Link to post
PizzaProgram 9 Posted October 13, 2023 6 minutes ago, FPiette said: Take OverbyteIcsHttpsTest.dproj sample program. Hmmm... that's interesting and promising, because I have compared: OverbyteIcsHttpsTst1.pas with OverbyteIcsXferTst examples and maybe my problem is, that I'm using TIcsHttpMulti component instead of a simple TSslHttpCli. It seems that the "multi" version calls SSL initialization automatically inside .Download() method. (I'm not calling it from anywhere before starting the download.) So the solution seems to be to get rid of this nice "multi-download" component and use a simple CLI. Thank you VERY VERY much for all the time You have invested to test it for me and to write it down in this topic! :-)))) Good Night! 1 Share this post Link to post
Fr0sT.Brutal 900 Posted October 16, 2023 BTW, you can use built-in WinInet functions for retrieving updates. They could handle HTTP(S) and FTP(S) with very low amount of code. Share this post Link to post