Jump to content
chkaufmann

Raw Request Logging for TIdHTTPServer

Recommended Posts

Hi,

 

I have to log each POST request to my TIdHTTPServer to a file. When I look at TIdHttpRequestInfo I don't find a property with the full data sent to my server.

 

Do I have to combine RawHeaders and PostStream in order to get the full request? 
Is there something else, where data is written to?
Is there a method I didn't see in order to get all this information in one block?

 

Regards
Christian

Share this post


Link to post
8 hours ago, chkaufmann said:

When I look at TIdHttpRequestInfo I don't find a property with the full data sent to my server.

Not the raw data as it came directly from the TCP socket, no.  By the time you are given access to the TIdHTTPRequestInfo object, all of the raw socket data has already been parsed and re-organized for Indy's purposes.  That being said, you can get the (near-raw) headers from the TIdHTTPRequestInfo.RawHeaders property, and the body data from either the TIdHTTPRequestInfo.PostStream or TIdHTTPRequestInfo.FormParams property, depending on the request's media type.

8 hours ago, chkaufmann said:

Do I have to combine RawHeaders and PostStream in order to get the full request?

Basically, yes.

8 hours ago, chkaufmann said:

Is there something else, where data is written to?

Is there a method I didn't see in order to get all this information in one block?

The only other option is to log the raw socket data immediately as it comes off the socket, before Indy parses it.  You can do that by assigning a TIdConnectionIntercept-derived object to the AContext.Connection.Intercept property in the server's OnConnect event.  For instance, one of the TIdLog... components, like TIdLogFile,

  • Thanks 2

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×