How can I access / change request headers / reponses on a DataSnap Delphi 2010 server

I am creating a DataSnap server that functions as a WebDAV server, and I am trying to read the request headers when using the DSHTTPS service, and then change the response headers.

Can someone point me in the right direction? I noticed that Trace TDSRequest and TDSResponse are the ancestors of TDSRequestIndy and TDSResponseIndy, and these components have access to headers, but I'm not quite sure how to get from TDSRequest to TDSRequestIndy.

Also, I did not think that Trace would be the cleanest way to access the request and responses, but this is the only way I have found so far.

Trying to do this with DataSnap, and not just Indy directly, is that I'm looking to use DataSnap for other remote methods.

+3
source share
1 answer

Perhaps you should consider using TidHTTPServer and create an indy server with many events and methods, rather than with a DSHTTPService, including OnBeforeBind, OnAfterBind, OnHeadersAvailable ... in which you have access to headers

+1
source

Source: https://habr.com/ru/post/1728401/


All Articles