Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodC++BuilderCode SnippetDelphiDemoFiremonkeyIOSOSXWindows

Secure Your REST Client With SSL And GZIP Compression In Delphi XE8 Firemonkey On Android And IOS

Delphi XE8 Firemonkey REST Client Demo With SSL And GZIP For Android And IOSIn Delphi XE8 Firemonkey the TRESTClient component is now backed by TNetHTTPClient which uses the native HTTP client on each platform (for example on IOS it uses NSURLConnection). This means that you no longer have to distribute OpenSSL libraries with your Delphi XE8 applications and you will be able to support SSL and GZIP. It should also support Deflate compression. When the native platform updates it’s SSL functionality you automatically take advantage of those updates as well. Under Delphi XE7 using GZIP was also possible. You want to use SSL to secure your application data and GZIP to reduce the size of your downloads especially on a mobile connection. This is especially important if you are building an enterprise app. Your web server must have GZIP enabled for the client to be able to use it. What I found with the new TNetHTTPClient component is that on IOS and Mac OSX the native NSURLConnection component automatically decompresses the content but on Windows and Android the content is still GZIPed. I am including a demo app for Android, IOS32, IOS64, Win32, Win64, and Mac OSX which contains a DecodeGZIPContent() function that utilizes TIdCompressorZlib.DecompressGzipStream depending on the platform where it is needed. Once you set the TRESTRequest.AcceptEncoding to ‘gzip, deflate’ the web server will know your client can accept GZIPed content and should send it to you. You should be able to use this demo with Appmethod as well. Here is the DecodeGZIPContent function from the demo:

Download the Delphi XE8 Firemonkey REST Client Demo With SSL And GZIP.



Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes


Ryzen 9 5950x: One Billion Lines Of Delphi Code Compiled In ~5 Minutes On 16 Cores


DelphiCon 2020 FireMonkey Sessions Available Starting November 19


Powerful Commercial Gorilla3D Framework Upgraded For Delphi FireMonkey On Windows And Android

Sign up for our Newsletter and
stay informed

Leave a Reply