EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElHTTPSClient - data not decompressed with Use100Continue?

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#27595
Posted: 12/09/2013 02:40:04
by Peter Palotas (Basic support level)
Joined: 11/01/2012
Posts: 49

When using TElHTTPSClient with UseCompression=true and Use100Continue=true and performing a POST request, the received data is not decompressed (from its gzip format provided by the server) automatically in the OnData callback. However, with Use100Continue=false the data is automatically decompressed.

Is this a bug in EldoS, or am I missing something?

I have tested it with the following program which sends a POST request to the eldos website and prints the headers received and the first 100 characters of the response to the screen. With Use100Continue enabled it just prints garbage, but I have verified that this is in fact gzipped data that can be decompressed. Without the use of 100-continue, the client automatically decompresses the data and the response is written in clear-text.


Code
class Program
   {
      static void Main(string[] args)
      {
         SBUtils.Unit.SetLicenseKey("XXX");
        
         TElHTTPSClient client = new TElHTTPSClient();
         client.UseCompression = true;
         client.Use100Continue = true;
         client.HTTPVersion = SBHTTPSConstants.TSBHTTPVersion.hvHTTP11;

         client.OnCertificateNeededEx += client_OnCertificateNeededEx;
         client.OnCertificateValidate += client_OnCertificateValidate;
         client.OnReceivingHeaders += client_OnReceivingHeaders;
         client.OnReceive += client_OnReceive;
         client.OnData += client_OnData;

         client.Post("https://www.eldos.com:443/cc/index.php?login=yes", "");
      }

      static void client_OnData(object Sender, byte[] Buffer)
      {
         Console.WriteLine("Data received:\n" + Encoding.UTF8.GetString(Buffer).Substring(0, 100));
      }

      static void client_OnReceivingHeaders(object Sender, SBStringList.TElStringList Headers)
      {
         foreach (var str in Headers)
            Console.WriteLine(str);
      }

      static void client_OnReceive(object Sender, ref byte[] Buffer, int MaxSize, out int Written)
      {
         throw new NotImplementedException();
      }

      static void client_OnCertificateValidate(object Sender, SBX509.TElX509Certificate X509Certificate, ref bool Validate)
      {
         Validate = true;
      }

      static void client_OnCertificateNeededEx(object Sender, ref SBX509.TElX509Certificate Certificate)
      {
         Certificate = null;
      }
   }
#27596
Posted: 12/09/2013 03:06:31
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for reporting the problem.

The fix will be included into the next SecureBlackbox build.

Reply

Statistics

Topic viewed 287 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!