HTTP Protocol Related Improvements in Delphi 10.2.2

by Jan 18, 2018

The new features for the HTTP client library offer more flexibility and options in terms of protocol and standards support. 

Better Secure Protocols Support

The first change is the improved support for security protocols. In the past it wasn't possible to specify the required security protocols (TLS1.1, TLS1.2, etc.) for an HTTP request. We have added a new enumeration, THTTPSecureProtocol with the values (SSL2, SSL3, TLS1, TLS11, TLS12). THPPTClient and related classes have now a SecureProtocols property which is a set based on that enumeration.

The property (available only at run-time) controls which security protocols to use and it is currently implemented only for Windows. This was requested in our Quality Portal at https://quality.embarcadero.com/browse/RSP-18713

HTTP Redirect Improvements

Another set of improvements is in the way the HTTP client library handles redirects. There is a new RedirectsWithGET runtime property offering another set of options, this time based on the following enumeration:

THTTPRedirectWithGET = (Post301, Post302, Post303, Post307, Post308, Put301, Put302, Put303, Put307, Put308, Delete301, Delete302, Delete303, Delete307, Delete308);

The property controls which request method and response status must be redirected using GET method and it was reported in several entries in QP, including https://quality.embarcadero.com/browse/RSP-14671.

New REST Client Events OnNeedClientCert and OnAuthEvent

These events corresponds to their HTTPClient counterparts and are now surfaces at a higher level:

TRESTClient.OnNeedClientCertificate: TNeedClientCertificateEvent TRESTClient.OnAuthEvent: TCredentialAuthEvent

This was requested in https://quality.embarcadero.com/browse/RSP-15857

MIME Name Helper

We added a function that to the TEncoding support, which returns the encoding MIME for a speficied encoding:

function GetEncodingMimeName(AEncoding: TEncoding): string;

Changed TIniFile Behaviour

This one is totally unrelated, beside the fact it was also done in 10.2.2. The Ini File behavior was platform specific, not is it platform independent. On Windows, TIniFile ReadString ignores the case of Key parameter. On Linux, the ReadString call was case sensitive, leading to issues when migrating code and configuration files. Now by default TIniFile content structure (not the actual values) is treated in a case-insensitive way on all supported platforms.