EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElHTTPSClient - view raw data sent

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
Posted: 02/03/2012 18:21:39
by Leonardo Herrera (Standard support level)
Joined: 02/14/2011
Posts: 66


I need to take a look at the data sent to the server, in plain text, so I can do some troubleshooting. My problem is that I'm getting garbage as content in my log viewer (it's just a SynMemo component.)

I'm using SecureBlackbox version 9.1.210 and Delphi XE.

This is my current code (the "client" object is a TElHTTPSClient component.) Am I handling the "OnSendData" handler correctly?

procedure TForm1.Log(Msg: String);

procedure TForm1.clientSendData(Sender: TObject;
  Buffer: Pointer; Size: Integer);
  S : String;
  SetLength(S, Size);
  Move(Buffer^, S[1], Size);

procedure TForm1.Send
  Data: TElStringList;
  xmlStream: TFileStream;
  client.CertStorage := Self.FStorage;
  client.OutputStream := Self.FOutputStream;

  client.PreferKeepAlive := true;
  client.RequestHeaders.Add('Cache-control: no-cache');

  Data := TElStringList.Create;
  Data.Add('data1=' + IntToStr(somedata));
  Data.Add('another=' + someOtherData);

    xmlStream := TFileStream.Create('c:\file.xml', fmOpenRead);
      client.Post('http://localhost/', Data,
        'archivo', 'file.xml', xmlStream, 'text/xml');
    // TODO: reporting
Posted: 02/03/2012 18:48:22
by Ken Ivanov (EldoS Corp.)

Please declare S as AnsiString (instead of String) in the clientSendData handler.
Posted: 02/03/2012 18:58:00
by Leonardo Herrera (Standard support level)
Joined: 02/14/2011
Posts: 66

That was fast. Yes, it worked. Thank you very much.



Topic viewed 781 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!