Is it possible to monitor all incoming traffic on an specific port? Even if a request doesn’t match a valid method? This would be helpful to detect external attacks or just to log messages from allowed consumers for troubleshooting purpouses.
I’m using TROIndyHttpServer with TROBinMessage/TROJSONMessage + Dispatchers and TROHttpApiDispatcher + TROHttpApiSimpleAuthenticationManager.
Relating to HTTPAPI it would be important to log Command, Full Path and especially the Body. Is there any possibilty?
procedure TServerMainForm.ROServerCustomResponseEvent(
const aTransport: IROHTTPTransport; const aRequestStream,
aResponseStream: TStream; const aResponse: IROHTTPResponse;
var aHandled: Boolean);
var
lMessage: IROMessage;
op: TROResponseOptions;
begin
// handle all requests equal to 'Bin':
if AnsiSameText(aTransport.PathInfo, '/Bin') then begin // "Bin" shouldn't be defined in Server.Dispathers !!!
// log info & data
MyLog(aTransport, aRequestStream);
// Invoke service method
lMessage:= (ROBinMessage as IROMessageCloneable).Clone;
MainProcessMessage(lMessage,atransport,aRequestStream,aResponseStream,op);
aHandled := True;
end;
end;