0

I'm using TIdHTTP a lot in my applications and users of mine requested a Socks4/5 feature with a specific timeout. I use my application to communicate with a SSL Website and I only worked with the regular ProxyParams before. How can I add Socks4 and/or Socks5 support to my TIdHTTP Component with a specific timeout?

Edit:

Since I don't have any Socks4/Socks5 proxies, I created my own with a new application to test. I added TIdSocksServer and assigned a TIdServerIOHandlerSSLOpenSSL to it. To make sure it connections I added a Messagebox to the OnConnect. The server listens on Port 8080 and is set to Active:=True;

Here is my code to with my TIdHTTP Component:

procedure NewQuery;
var
 IDHTTP                                : TIdHTTP;
 SSL                                   : TIdSSLIOHandlerSocketOpenSSL;
 Socks                                 : TIdSocksInfo;
begin
 Socks                                 := TidSocksInfo.Create (NIL);
 IDHTTP                                := TIdHTTP.Create(NIL);
 SSL                                   := TIdSSLIOHandlerSocketOpenSSL.Create(NIL);
 IDHTTP.IOHandler                      := SSL;
 SSL.TransparentProxy                  := Socks;
 Socks.Host                            := 'localhost';
 Socks.Port                            := 8080;
 Socks.Authentication                  := saNoAuthentication;
 Socks.Version                         := svSocks4; // or svSocks5
 IDHTTP.ConnectTimeout                 := 5000; // 5 seconds
 IDHTTP.Get ('www.google.com');
end;

Not sure if I used this the right way but it seems like that the GET request works without having it connected to the socks server. Am I using it wrong?

4

1 回答 1

2

TIdSocksInfo组件分配给 IOHandler 的TransparentProxy属性。

于 2013-09-12T15:17:17.000 回答