Amir Lajevardi
Amir Lajevardi

Reputation: 23

Indy IdHttp Proxy, which protocols Support?

I am using indy idhttp to work with telegram api,my code is something like this:

  LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  idHttp.ReadTimeout := 30000;
  idHttp.IOHandler:=LHandler;
  LHandler.SSLOptions.Method := sslvTLSv1;
  LHandler.SSLOptions.Mode := sslmUnassigned;
  idHttp.HandleRedirects := true;
  //Proxy Code...
  idHttp.Post( API + msg, Params, Stream);

my code works just fine,but the problem is because of censorship and filtering in my country ,i have to use VPN Services such as AnyConnect,L2TP,... Now my question is how can i use Indy ProxyParams to bypass censorship and post data,of course I know that i have to add below code before idhttp.post but i can't figure out which protocols does it supports or which VPN services should i use? Thanks in Advance.

  idHttp.ProxyParams.ProxyServer:='xxxxxx';
  idHttp.ProxyParams.ProxyUsername:='user';
  idHttp.ProxyParams.ProxyPassword:='pass';
  idHttp.ProxyParams.ProxyPort:=xxx;

Upvotes: 0

Views: 709

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 595367

The TIdHTTP.ProxyParams property only supports HTTP-based proxies that use the CONNECT verb to tunnel TCP connections.

For other types of proxies, you have to use the TIdIOHandlerSocket.TransparentProxy property instead. For instance, to use a SOCKS proxy, assign a TIdSocksInfo component as the TransparentProxy.

VPNs are different than proxies. VPNs are handled at the networking layer, not at the application layer. You have to connect to a VPN from outside of your app first, then you can use your app normally, connecting it to the target server through the VPN network. If your OS only has 1 network installed, this is usually handled automatically for you. If your OS has multiple networks installed, or if you just want to be explicit about it, then you can tell TIdHTTP which network connection to use by setting its BoundIP property to the local IP address of the desired network.

Upvotes: 2

Related Questions