EldoS | Feel safer!

Software components for data protection, secure storage and transfer

HTTP client, request and cookies

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#3164
Posted: 06/18/2007 12:01:25
by Stephane Grobety (Priority Standard support level)
Joined: 04/18/2006
Posts: 170

Hello,

I'm trying to duplicate the behavior of the "curl" program with the HTTP client and I'm having a problem.

basically, I need to "dump" all the HTTP request hearders to make sure they match what I need (the process is not working and I need to know why). To that effect, I inplemented a handler to the TElHTTPSClient.OnPreparedHeaders event and dumped the parameters into a memo.

Unfortunately, it seems that, at this stage, the cookies aren't in the headers. In fact, the cookies and header text are only combined in the "GetRequestCookies method and, at this stage, it's too late for a dump (there is no even implemented afterward).

I fixed this by moving the concatenation of the cooki string and the rest of the header back to the InitiateRequest methode and removing the trailing CRLF at the end of GetRequestCookies.

Could you please check this bug fix and repercute it into the main code base ?

BTW, is there some specific question why cookies aren't treated the same way as other header fields are ? After all, it's no different from other headers.
#3165
Posted: 06/18/2007 12:21:59
by Eugene Mayevski (EldoS Corp.)

There's no bug there and nothing to fix. You can dump the data by handling OnSend event.


Sincerely yours
Eugene Mayevski
#3166
Posted: 06/19/2007 01:42:29
by Stephane Grobety (Priority Standard support level)
Joined: 04/18/2006
Posts: 170

Thank you for answering.
If there is no bug then why is it that "OnPreparedHeaders" doesn't actually pass the real headers to the handler ?

If it's meant to fire once all the headers have been "prepared", the the cookie header should be part of it. If it's not, then the event is useless and misleading (as the hour I spent trying to figure out why I wasn't passing the cookie to the server that was expecting it demonstrate).

As for the "onSend" event, it doesn't exist in the TElHTTPSClient component and, even if it did, it wouldn't fit the same role.

Thanks for your help,
Stephane
#3172
Posted: 06/19/2007 06:16:32
by Eugene Mayevski (EldoS Corp.)

The event is not available directly, but can be made accessible with easy pascal trick of creating a descendant class.
As for OnPreparedHeaders, the event lets you change the headers before sending. Cookies are not to be changed (they are set in other place) so they are not included.
OnPreparedHeaders was not designed for capturing the request.


Sincerely yours
Eugene Mayevski
#3175
Posted: 06/19/2007 09:29:02
by Stephane Grobety (Priority Standard support level)
Joined: 04/18/2006
Posts: 170

Hello again,

OnSend is never fired by the descendant. It's only fired if "UseInternalSocket" is set to false in which case there is no more handling of the communication at all.

I'm slowly moving to the stage where I (hopefully) will not need to log anymore so the problem is getting less important. Still, it would really have been convenient to have a way to grab the cleartext of the queries and answers (ALL the clear text, not just some random portions).
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.

Reply

Statistics

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