Receiving information about client on server-side

ro
delphi

(EvgenyK) #1
procedure TNewService.RORemoteDataModuleGetDispatchInfo(
const aTransport: IROTransport; const aMessage: IROMessage);
var
  tcpinfo:IROTCPtransport;
  httpinfo:IROHTTPTransport;
  client_address: string;
begin
   client_address := '';
    if Supports(aTransport, IROTCPtransport, tcpinfo) then
      client_address := tcpinfo.GetClientAddress;
    if client_address = '' then
      if Supports(aTransport, IROHTTPTransport, httpinfo) then begin
        client_address := httpinfo.Headers['REMOTE_ADDR'];
        if client_address = '' then client_address := httpinfo.Headers['HTTP_CLIENT_IP'];
        if client_address = '' then .... // check for others headers like REMOTE_ADDR, 
					 //HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR (can be comma delimited list of IPs), 
					 //HTTP_X_FORWARDED, HTTP_X_CLUSTER_CLIENT_IP, 
					 //HTTP_FORWARDED_FOR, HTTP_FORWARDED
      end;
  //Log('Client ' + client_address + ' connected!');
end;

Whitelist Client via IP Address
Detect calling server-instance from service-method
Is it possible to have two or more Server components in one Delphi project serving different Librarys or Services?
Read header data from a HTTP POST request
Loging metod call
How to limit JSON Message response to an specific service
Client IP address