Jump to content

Angus Robertson

Members
  • Content Count

    1690
  • Joined

  • Last visited

  • Days Won

    32

Everything posted by Angus Robertson

  1. Angus Robertson

    Load DLL from resource, bypassing a file?

    Which is what I'll do for the first version, may experiment later with memory loading, but don't plan to spend much effort on it. Angus
  2. Angus Robertson

    KeepAliveTimeSec of TSslHttpServer

    But those five minute client connections are not shown in either of the logs you posted. How do you know the server closed the connection, and not the client, windows or a router? Angus
  3. Angus Robertson

    KeepAliveTimeSec of TSslHttpServer

    The new log does not show any client connections. If you wish me to investigate an ICS problem, I need to be able to reproduce that problem or have extensive logs that clearly illustrate the problem such that it can be found and fixed. Those logs need to be annotated to show what I'm supposed to look at to see the problem. The current ICS samples don't log sufficient detail to show when and why connections close, and why the server has been closed. That information has never been needed, since the servers have been running in various versions for 20 years without unexpected closing being reported as a problem. Angus
  4. Angus Robertson

    Load DLL from resource, bypassing a file?

    My plan is to build the OpenSSL resource file at the same time as signing the DLLs and distribute them together in the zip for each new release. The latest resource file will also be part of the ICS distribution alongside the latest DLLs. ICS will only support OpenSSL 3.0 and later, versions will under support. The resource files will have the three DLLs, licence file, and a version string, used for the path when extracting the DLLs into a temporary directory. Is there anything else that would be useful to allow other projects to use the same OpenSSL resource files, to avoid building their own? Angus
  5. Angus Robertson

    KeepAliveTimeSec of TSslHttpServer

    The log shows several sessions from an older VCL web server sample, it does not log when buttons are clicked to start and stop the server. The two GET requests are closed after a few seconds, the server was closed about 90 seconds later, no idea why but unconnected to the client closing. I don't see any client connections held open by the browser, and certainly nothing closed after five minutes. The FMX IcsSslMultiWebServ sample has better logging straight to file, particularly when the Display HTTP protocol box is ticked, but does not log time stamps nor sessions closing, so would need some updating to log the problem you seem to be having. Angus
  6. Angus Robertson

    KeepAliveTimeSec of TSslHttpServer

    Using the IcsSslMultiWebServ sample I asked you to test? Can I please see the server log file? Angus
  7. Angus Robertson

    Load DLL from resource, bypassing a file?

    Thanks all, BTMemoryLoadLibary and BTMemoryGetProcAddress would appear to be the solution, but do add a lot of extra code. I think I'll implement the simpler save/load resource first, which will be conditional, then look at adding more conditional code to optionally load directly to memory. Ultimately, how to build applications is up to the developer. The OBJ solution is best, it's called YuOpenSSL, but is not a simple compile of the OpenSSL C code, lots of macros and other issues. Angus
  8. Angus Robertson

    ICS V9.0 announced

    All your questions have been answered previously, more than once, and today again. Angus
  9. My earlier comments did state this is an old unsupported component, with better modern components. Angus
  10. 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
  11. Angus Robertson

    TSslHttpRest and multipart/form-data

    Assuming you don't want to upload a file, you should change the code you showed to remove TMultiPartFileReader, just build a single MIME block from your header and footer, change capture.jpg to your full file name in s. and use the string as raw parameters in the REST call, which will automatically create the SendStream for the request. RestRequest(httpPost, URL, False, MyMimeHeaders); Angus
  12. Angus Robertson

    ICS 8.70 VCLCB110 64 bits compile error

    Can any other ICS C++ users reproduce this Win64 issue? If no-one is willing to help us support C++, I'll have to remove C++ support from ICS. Angus
  13. Angus Robertson

    TSslHttpRest and multipart/form-data

    The TMultiPartFileReader class you have used opens and converts file content to MIME base64, for a file upload. Earlier, you said you didn't want to upload the file. But I'm still waiting for you to show an actual example of the data you are trying to POST. Angus
  14. Angus Robertson

    Load DLL from resource, bypassing a file?

    We are providing component libraries for others to built SSL capable applications, and avoiding DLLs does come up regularly, it should be an option that other developers can use or ignore. The best solution is YuOpenSSL which is OpenSSL compiled into a DCU so no DLLs. It does increase application size, probably the same as using resources, but generally applications using OpenSSL distribute their favourite version of the DLLs in their application directory, so you end up with numerous similar DLLs all over the place. But YuOpenSSL is a lot of effort to maintain and is therefore a commercial product not everyone wants to buy. In theory, the OpenSSL resources only need to be written to files once, but making sure those files are the latest or oldest versions may be challenging. Angus
  15. Angus Robertson

    TSslHttpRest and multipart/form-data

    Thanks, effectively this site seems to be requiring the same parameters as a web browser submit form, rather than the more normal content used by REST APIs. The ICS TRestParam class can already generate seven different content types, Json, UrlEnc, XML, CSV etc, so I need to add FormData as an eighth content type, I'll look at it next week. Effectively this will be a more generalised version of the file uploading code I already recommended, but without actually uploading a file which it seems was a red herring. Angus
  16. Angus Robertson

    TSslHttpRest and multipart/form-data

    I don't know anything about Postman. If you are not sending a binary file, there is no point in using MIME. It's just a simple REST request. I need to see what HTTP data Postman creates, not what the GUI says, to make any sensible suggestions. Angus
  17. Angus Robertson

    TSslHttpRest and multipart/form-data

    The TSslHttpRest file upload feature is designed to replicate a web browser uploading a file from a web page using a Submit command. You can see how the MIME content is built in the TSslHttpRest.RestRequest function at line 2910 in OverbyteIcsSslHttpRest.pas, you'll need to build a similar post stream before calling the component with your own Json requirements. However, your description of needing a 'full local path to the image' seems strange, unless your REST request is to a server on the same PC, normally you'd expect to send JPG image data or something, not a file name, Angus
  18. Angus Robertson

    TSslHttpRest and multipart/form-data

    Uploading files is built into the TSslHttpRest component. The main OverbyteIcsHttpRestTst sample has a menu option Upload File, select MIME Multipart, specify the Upload File Name, POST or PUT, and any REST parameters needed, it just works. The OverbyteIcsSnippets sample has a much simpler demo where you click a single button 'HTTP POST Upload File' which runs a single function to upload a file to one of my servers. Angus
  19. Angus Robertson

    Get OAuth2 authorization code into a VCL desktop application

    The latest ICS offers OAuth2 with embedded Edge or MSIE browsers or external browser and a private web server. Pre-built samples at https://wiki.overbyte.eu/arch/icsdemos-clients.zip Angus
  20. Angus Robertson

    Hext to Byte to Text = x509 cert

    Look-up base64 conversion in the help, then break the lines to 64 long and add the --- header and footer you see in a PEM certificate file. Angus
  21. OpenSSL has released new versions of the three active branches. These releases fix a low severity issue with the Win64 POLY1305 MAC implementation corrupting XMM registers ([CVE-2023-4807]) which applies only to processors released in the last two or three years supporting AVX512-IFMA instructions. Windows binaries are available in SVN and the overnight zip file (tomorrow) and separately from https://wiki.overbyte.eu/wiki/index.php/ICS_Download or https://www.magsys.co.uk/delphi/magics.asp Separately, YuOpenSSL has released 3.0.11 and 1.1.1w as commercial DCUs allowing applications to be used with OpenSSL without needing separate DLLs. Note that 1.1.1w is the last release of that version, it is now out of support unless you have an OpenSSL Premium Level Support contract for $50,000/year. Angus
  22. ICS will now build again with the OpenSSL DLLs. Angus
  23. Sorry about that, new function added this week, tested with YuOpenSSL, but obviously need to update the DLL imports as well, will be done today. Just use the old wsocket unit until it's done. Angus
  24. Angus Robertson

    How to validate the public key

    A PEM certificate is base64 encoded lines of the binary DER, with a header and trailer added, although ICS often adds comments to the files for identification purposes. So could just strip off the headers, remove line endings and do a comparison of the base64 text. Is your server also ICS? So it could be updated for Raw Public Key TLS support? Angus
  25. Angus Robertson

    OpenSLL Dlls path

    There are several global variables used to determine how OpenSSL is loaded, this chunk of code is from the OverbyteIcsHttpRestTst1 unit, but most ICS samples have something similar. // Avoid dynamical loading and unloading the SSL DLLs plenty of times // GSSLEAY_DLL_IgnoreNew := True; { ignore OpenSSL 3.0 and later } // GSSLEAY_DLL_IgnoreOld := True; { ignore OpenSSL 1.1 } // note both not allowed true GSSL_DLL_DIR := FProgDir; { only from our directory } GSSL_SignTest_Check := True; { check digitally signed } GSSL_SignTest_Certificate := True; { check digital certificate } OverbyteIcsWSocket.LoadSsl; if NOT GSSLStaticLinked then begin if NOT FileExists (GLIBEAY_DLL_FileName) then LogWin.Lines.Add('SSL/TLS DLL not found: ' + GLIBEAY_DLL_FileName) else LogWin.Lines.Add('SSL/TLS DLL: ' + GLIBEAY_DLL_FileName + ', Version: ' + OpenSslVersion); end else LogWin.Lines.Add('SSL/TLS Static Linked, Version: ' + OpenSslVersion); This version ensures the DLLs are only loaded from our own directory using GSSL_DLL_DIR, since Windows may have dozens of different versions of the DLLs scattered around the drive from different applications. The code loads OpenSSL once and tells you what version it found and where, and whether YuOpenmSSL is being used which avoids all DLL problems. Might have to revisit the IgnoreNew/Old stuff since 1.1 is now out of support. Angus
×