Jump to navigation Jump to search
Revision as of 18:59, 6 January 2022 by Magsys (Created page with "Changes in '''ICS V8.68''' include: #V8.68 is a minor release, mainly HTTP client and server improvements including new request and response headers to assist browser caching...")
Changes in ICS V8.68 include:
- V8.68 is a minor release, mainly HTTP client and server improvements including new request and response headers to assist browser caching and conditional requests, improved error reporting to help diagnose failed HTTP requests, and improvements in the HTTP REST component allowing it to save files including resuming failed downloads and download files of any size. There are minor fixes in various components, and updates to installing on MacOS and C++ Builder. There is also a new File Clean-Up demo ideal for deleting the old log files that many applications (including some ICS samples) leave on systems.
- The HTTP client TSslHttpCli now keeps the Etag response header as ResponseEtag, allowing applications to save it with the page content, and when requesting a refresh to add the request method ReqIfNoneMatch or ReqIfMatch to avoid downloading the page again. Made RequestDoneError available as property so it can be accessed after Sync requests, and added RequestDoneErrorStr property that returns a literal error. Improved RequestDoneError to give more information than a simple abort, added httperrOutOfMemory and httperrBgException which happen while receiving and processing data in the OnDocData event and httperrSslHandShake. Improved AbortComponent so ReasonPhrase now reports the exception that caused it, such as out of memory which previously needed a BgException event handler. For range downloads, added the ContentIfRange request header which can send an RFC1123 date or Etag so a partial download only happens if the file is unchanged.
- Previously, the HTTPS REST client TSslHttpRest always downloaded content to a TMemoryStream with content size being limited to MaxBodySize (default 100 MByte), and generally restricted by memory to less than 250 MByte. To remove this limitation, added the HttpMemStrategy property with THttpMemStrategy on how to handle downloads: HttpStratMem only TMemoryStream; HttpStratTemp uses a work file in the system temporary directory for sizes larger than MaxBodySize; HttpStratFile always writes a named file HttpDownFileName (with .part extension during download); HttpStratResume is similar to httpStratFile but supports resume of failed partial downloads (with .http extension for resume information). Property ResumeMinSize defines the minimum sized partial file that should be resumed, rather than start again (default 64K). Note MaxBodySize remains the maximum size for ResponseRaw (unicode string), JSON and XML parsing. Note this is a breaking change since the ResponseStream property is now TStream, so to use the SaveToFile method you will need to be cast as TMemoryStream. Or change to use HttpStratFile method with HttpDownFileName. Also note, ResponseStream remains open after request completes and may occupy a lot of memory or leave file open (read only), also ResponseRaw string, so use ClearResp method when no longer needed. The component now logs a better error if the response does not contain Json. Added ShowProgress property that causes download information to be sent to the OnHttpRestProg event using LogOption=loProgress, showing progress in KBytes of KBytes updated every ProgIntSecs seconds, default two, expected to be displayed as a caption. The OverbyteIcsHttpRestTst.dpr sample has fields to select a Download File Name when saving a file and for Memory Strategy, download progress is also displayed.
- The HTTP server TSslHttpServer now supports the If-Range, If-Match and If-None-Match request headers for conditional pages using Etag or last modified date, and sends 304 not modified for matches, to help with caching. Added an ETag header to responses in AnswerStream and AnswerPage when we can create one from a file modification date and size (base64 CRC32), or if the EntityTag property is specified in the client onGetDocument event before using hgSendDoc or hgSendStream, perhaps a CRC32 of the entire content from a cache. The 304 not modified response now includes more recommended headers. Also add a Date: header to AnswerStream and AnswerPage responses to help with caching. Note, if applications already add Date: or Etag: to CustomHeaders or to an AnswerStream should remove them to avoid duplication.
- The Multi HTTPS client TIcsHttpMulti has been updated to a fix a problem that meant large files failed download with only an abort error if too large for TMemoryStream, now downloaded to TFileStream with .part extension and renamed up successful completion. If a partial file downloads, don't delete it if KeepPartDown=True. Added logging of RequestDoneError on failure and BgException. Correctly download files using chunked coding without known size, note these show with size -1 since not known until complete. These fixes were triggered by failed HTTP 300 MByte downloads from a new HD CCTV camera that said abort with no mention of out of memory errors, thus a lot of debugging and ICS changes to improve matters.
- The previous ICS release added support for the OpenSSL 3.0 release. Now it's been available for three months it has been added to the main istribution, the samples SslInternet directory now has both OpenSSL 1.1.1m and 3.0.1, ICS will try and load OpenSSL 3.0 first, then 1.1.1 if not found, unless the global variable GSSLEAY_DLL_IgnoreNew is set true before OpenSSL is loaded. Likewise GSSLEAY_DLL_IgnoreOld may be set true to ignore 1.1.1 and fail unless 3.0 is available. ICS now supports YuOpenSSL 3.0 and 1.1.1 versions as commercial DCUs allowing applications to be used with OpenSSL without needing separate DLLs, except it still loads providers like legacy.dll as DLLs, not a DCU.
- In TIcsWndControl, BgException now passes the exception to the AbortComponent virtual handler and ExceptAbortProc method so higher level components can report errors better, such as out of memory without needing an BgException handler. Note requires similar change to all units that override bortComponent or use ExceptAbortProc.
- The TX509Base component now supports OpenSSL 3.0 for Load/SaveP7BFile. ValidateCertChain no longer reports an error for the expired 'DST Root CA X3' CA root, since some platforms accept expired roots. Improved OpenSSL error handling to say 'No error returned' instead of error:00000000:lib(0):func(0):reason(0). TWSockey now clears LastError in Listen and Connect methods to avoid false errors later. Improved source description for some fatal background errors.
- In TSslX509Certs, added property KeepOldCA set true to keep the old Let's Encrypt intermediate for the expired DST Root CA X3 root in bundles to support old Android releases. Keeping it may prevent some clients verifying the chain and SslLabs testing gives a chain warning.
- In TIcsFileCopy, the DeleteFiles method now supports a new Zipped property so files are zipped with .zip extension before being deleted, useful for cleaning up old logs to save space (requires VCLZip). The OverbyteIcsXferTst,dpr sample has a new File Clean-Up tab to test the multiple DeleteFiles method, it allow files older than x days or a specific date range to be archived/zipped (to save space) or deleted, ideal for deleting the old log files that many applications (including some ICS samples) leave on systems.
- In the FTP client TSslFtpClient, using the PORT command to set Active mode now prevents other FTP clients sharing the same port number and address, usually only a problem with a small port pool (which is not recommended). For an Abort, LastResponse now reports the exception that caused it, such as out of memory which previously needed a BgException event handler.
- In the Multi FTP client TIcsFtpMulti, improved TLS session caching by ignoring the connection port so the data sessions can use the control session.
- Updated the trusted root certificate bundle files, lots of changes from Microsoft since June, Google is now issuing it's own certificates. Updated the build-in sslRootCACertsBundle, few gone, now total 59 certificates commonly used.
- ICS should now build with C++ for RAD Studio 10.4 and 11.0, fixed the 11.0 packages and various Windows API related units, including for Win64. The Platform FMX samples now build with RAD Studio 11.0 where some FMX properties have changed, not sure if they'll still build with older versions. Building samples no longer needs the source search path to have \Include, this has been added to all the sample units that use OverbyteIcsDefs.inc.