Jump to content


  • Content Count

  • Joined

  • Last visited

Posts posted by Keesver

  1. Hello,


    I'm using a TIdHTTPProxyServer component to create a proxy server for our application. Unfortunately the proxy server frequently blocks communication. As a test, I put a TIdHTTPProxyServer on a form and use this proxy i.c.m. with a call to a RemObjects server. I added an interceptor to log the output of the proxy component (see attachment). From this file I can see that the proxy server hangs on this call (see also attachment): Stat Connected. Recv 12/08/2022 15:59:26: POST http://service.a-dato.net:80/handler.ashx/binmessage HTTP/1.1
    Host: service.a-dato.net
    Keep-Alive: 300
    Proxy-Connection: keep-alive
    User-Agent: Remoting SDK
    Content-Type: text/html
    Content-Length: 17
    Accept-Encoding: identity
    Connection: keep-alive
    }Ðm�BÐ�@�Fx8‘¯®V� (data is binary)


    • The first call to the server succeeds
    • The problem comes on subsequent calls to the server (pressing 'Call service (8081)' multiple times)
    • This problem only occurs when I use 'http' (using 'https' it works)
    • It works when I use no proxy
    • It works when I use another proxy (the second button will use Fiddler as a proxy server)
    • When you run the test application, a logfile is written to 'c:\Temp\Log'


    I have attached a test application to replicate the problem.


    Thanks for your support and comments.





  2. I purchased MIDA some time ago, it did what it had to do. Unfortunately it stopped working because the tool contacts a registration server at startup and this server has been down for a long time now (I think more than 2 years). I could never reach the developer/company behind MIDA.


    There is another tool that can help out though: INNOVA Solutions - Delphi Code Converter - VCL Form to FireMonkey FMX Form


    Sorry for bringing the bad news.

  3. I have done some more testing and found that my setup fails because the proxy on the server tries to connect to the local proxy from a different port number/connection. This communication is (logically) blocked by the firewall. 


    I thought this code made the server proxy communicate through the same channel as previously established between client and server:

        var tempIO := TIdIOHandlerStack.Create(AContext.OutboundClient);
        tempIO.OnBeforeBind := IOHandlerStack_BeforeBind;
        tempIO.ReuseSocket := rsTrue;
        tempIO.BoundPort := IdHTTPProxyServer1.Bindings[0].Port; <== Re-use outbound port from server to prevent blocking by firewall

    On the client side, I would strongly advise you NOT to bind the TIdTCPClient and TIdHTTPProxyServer to the same local IP/Port at all.  Put the destination proxy server's IP/Port in the DEST command itself, and then have the receiving server extract the values from the command, not from the connected socket.  Then you can drop the TIdTCPClient connection after sending the DEST command, and even run the TIdTCPClient on a different PC if you wanted to.

    I think this cannot work because the server proxy cannot reach the local proxy through the firewall. The connection between the two proxies must be initiated from the "inside".


    This is what I'm trying to achieve:


    Remote <x> Server proxy <x> local (reverse) proxy < > Internal network
    'x' = firewall


    1. local proxy opens connection with Server proxy
    2. local proxy sends 'DEST commend' to register itself with Server proxy
    3. Remote queries Server proxy for available clients
    4. Remote sends 'REMOTE' command to server to to connect to a certain 'DEST'
    5. Remote starts HTTP communication with given 'DEST' ==> here it failes because server proxy opens new channel to local proxy


    Maybe my setup will never work and should I follow a very different path. Hints and tips more than welcome.


  4. There is no error, the call from the remote server back into the client simply does not reach it's destination. The remote server does receive a HTTPBeforeCommand event, this line is being called on the server: 

    Writeln('Command redirected to DESTINATION: ' + dest_ip + ' - ' +  dest_port.ToString);

    The connection between client and server seems to be working. When I use telnet to connect to the server, I do get a response from the server when I execute the 'HELP' command. Similar the call to SendCmd('DEST') in our client returns '200 OK'. Also 'netstat' shows an active connection between client and server.


    Maybe my question is: what do I need more that an active (TCP) connection between client and server? 

    Does the HTTP Proxy server requires additional channels to be opened to make this work? Or should the single channel suffice?

  5. Hello,

    We want to add remote support to our application and for this we want to use two idHttpProxyServer's chained together. The first server resides on our public server, the second instance resides on the customers network. This is the code we are using:


    public server:

    constructor TRemoteServer.Create(IP: string; Port: Integer);
      IdHTTPProxyServer1 := TIdHTTPProxyServer.Create(nil);
      IdHTTPProxyServer1.ReuseSocket := rsTrue;
      IdHTTPProxyServer1.DefaultPort := Port;
      IdHTTPProxyServer1.OnHTTPBeforeCommand := HTTPBeforeCommandHandler;
      var handler := IdHTTPProxyServer1.CommandHandlers.Add;
      handler.Command := 'DEST';
      handler.HelpSuperScript := 'Sets caller as a DESTINATION for remote support (usage DEST PIN URL)';
      handler.OnCommand := DEST_Handler;
      if (IP <> '') and (Port <> 0) then
        Writeln('Starting server, binding to: ' + IP + '-' + Port.ToString);
        var bind := IdHTTPProxyServer1.Bindings.Add;
        bind.IP := IP;
        bind.Port := Port;
        bind.ReuseSocket := rsTrue;
      end else
        Writeln('Starting server, default binding');
      IdHTTPProxyServer1.Active := True;
      Writeln('Server running, listening on: ' + IdHTTPProxyServer1.Bindings[0].IP + ' - ' + IdHTTPProxyServer1.Bindings[0].Port.ToString);
    procedure TRemoteServer.DEST_Handler(ASender: TIdCommand);
      dest_ip := ASender.Context.Binding.PeerIP;
      dest_port := ASender.Context.Binding.PeerPort;
      dest_pin := ASender.Params[0];
      dest_url := ASender.Params[1];
      Writeln('Address: ' + dest_ip + ' - ' + dest_port.ToString);
    procedure TRemoteServer.HTTPBeforeCommandHandler(AContext: TIdHTTPProxyServerContext);
      if dest_ip <> '' then
        Writeln('Command redirected to DESTINATION: ' + dest_ip + ' - ' +  dest_port.ToString);
        var tempIO := TIdIOHandlerStack.Create(AContext.OutboundClient);
        tempIO.ReuseSocket := rsTrue;
        // tempIO.BoundIP := ''; //IdHTTPProxyServer1.Bindings[0].IP;
        tempIO.BoundPort := 443; // IdHTTPProxyServer1.Bindings[0].Port;
        var tempProxy := TIdConnectThroughHttpProxy.Create(AContext.OutboundClient);
        tempProxy.Enabled := True;
        tempProxy.Host := dest_ip;
        tempProxy.Port := dest_port;
        tempIO.TransparentProxy := tempProxy;
        AContext.OutboundClient.IOHandler := tempIO;

    Client code:

    procedure TForm1.ConnectToRemote(Connection: string);
      HTTPProxyServer.Active := False;
      IdTCPClient1.Host := <SERVER IP/URL>; //Connection.Split([':'])[0];
      IdTCPClient1.Port := <SERVER PORT>; // Connection.Split([':'])[1].ToInteger;
      // Tell server we are there
      IdTCPClient1.SendCmd('DEST 4444 https://abc.com');
      var bind := HTTPProxyServer.Bindings.Add;
      bind.IP := IdTCPClient1.Socket.Binding.IP;
      bind.Port := IdTCPClient1.Socket.Binding.Port;
      bind.ReuseSocket := rsTrue;
      HTTPProxyServer.Active := True;

    This setup works when we run both server and client on the same computer. However, when we put the server on a remote computer, it does not work. 


    Should this work, or do we need other means to make this happen?


    Thanks and regards,


  6. ok, will do.


    I was trying to use FDBatchMove + FDBatchMoveSQLWriter to import a table from MSSql into Interbase. The internal table generator uses 'Int64' for such fields, am I using the wrong generator?






  7. Which data type should be used for Int64 values?


    I tried Int64 and bigint, both return an error:

    create table Test(ID Int64)

    create table Test(ID bigint)


    Error message:

    Project IBTest.exe raised exception class EIBNativeException with message '[FireDAC][Phys][IB]Dynamic SQL Error
    SQL error code = -607
    Invalid command
    Specified domain or source column does not exist'.



  8. Hello,


    We are looking at safely handling queued calls. The problem is that under some circumstances the object used inside the queued method is freed before the method gets executed. This raises an exception. Can we use this construct to fix it:


      ITest = interface
        function GetName: string;
        procedure SetName(const Value: string);
      TTest = class(TInterfacedObject, ITest)
        FName: string;
        function GetName: string;
        procedure SetName(const Value: string);
      TObjectWithTest = class
        FTest: ITest;
        constructor Create(const AInterface: ITest);
        procedure   QueueCallSafe([weak]AInterface: ITest);
        function GetTest: ITest;
    procedure TObjectWithTest.QueueCallSafe([weak]AInterface: ITest);
      TThread.ForceQueue(nil, procedure begin
        if AInterface = nil then
          ShowMessage('nil') else
          ShowMessage('not nil');
    procedure TForm1.Button3Click(Sender: TObject);
      var obj := TObjectWithTest.Create(TTest.Create);
      // Free object --> [weak] reference will be cleared (no exception!!)


  9. We are using EV (extended validation) code signing certificates to add trust, this should prevent Windows from asking additional confirmation when installing our software. In addition, when the certificate is renewed, trust statistics are kept because the new certificate is recognized as being the same as the 'old' one. Requesting such a certificate requires extra steps during the certification process.
    (I can send you an installation url if you want to see how this works out)

  10. Thanks everyone for your comments. Enough information to look into.

    The Delphi language guide looks like a good starting point, this is something the person can do by themselves.


    @David: your comments include a good list of topics that need to be touched in the learnings. 



    Kees Vermeulen



  11. We are preparing to release our software using Thinfinity as an alternative to the desktop version. We did some tests and this showed it worked pretty good. We do want to change our application to make it look more 'web' alike. This means hiding the menu for example. Can't tell yet how performant it will be. You do need a server capable of handling the number of concurrent users of your application though.

    We were told RDS licenses are not required because Thinfinity does not use the RDS services (which I can confirm after running multiple sessions on the same server without such license). I can't say if Microsoft agrees on this....