Autor Beitrag
expl0
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Mi 25.09.13 14:54 
Hallo zusammen ich finde einfach keine Lösung im Netz zu meinem Problem.

Wenn ich das mit meinem IdHTTP Komponente SOCKS5 Proxy (und ein nicht https URL) verwenden, funktioniert alles ohne Probleme.

Wenn ich die IdHTTP Komponente mit einem SSL-URL (und kein SOCKS5 Proxy) verwenden, funktioniert alles ohne Probleme.

Wenn ich die IdHTTP Komponente mit SSL und URL und ein SOCKS5 Proxy verwenden bekomme ich folgende Fehlermeldung:

Linie 405 der Fehlerausgabe idSocks.pas (raise EIdSocksServerGeneralError.Create (RSSocksServerGeneralError);

Hier mein Code

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
var
  HTTP            : TIdHTTP;
  Cookie          : TIdCookieManager;
  SSL             : TIdSSLIOHandlerSocketOpenSSL;
  Params          : TStringList;
  HTMLSource      : String;
  CurrentProxy    : String;
  ProxyPort       : Integer;
  ProxyHost       : String;
  ProxyUsername   : String;
  ProxyPW         : String;
begin
  Synchronize(AddItem);
  HTTP                          := TIdHTTP.Create(NIL);
  Cookie                        := TIdCookieManager.Create(HTTP);
  SSL                           := TIdSSLIOHandlerSocketOpenSSL.Create(HTTP);
  HTTP.CookieManager            := Cookie;
  HTTP.IOHandler                := SSL;
  HTTP.HandleRedirects          := True;
  Params                        := TStringList.Create;
  HTTP.Request.UserAgent        := Task^.Useragent;
  try
    while True do begin
      if terminated then Exit;
      Params.Clear;
      Cookie.CookieCollection.Clear;
      if Task^.Proxytype >= 0 then begin      // if proxy enabled
        CurrentProxy            := Task^.Form.GetProxyFromPool;
        ProxyHost               := ParsingW(':', CurrentProxy, 1);
        ProxyPort               := strtoint(ParsingW(':', CurrentProxy, 2));
        HTTP.ConnectTimeout     := (Task^.Proxytimeout * 1000);
        if Task^.ProxyAuth then begin
          ProxyUsername         := ParsingW(':', CurrentProxy, 3);
          ProxyPW               := ParsingW(':', CurrentProxy, 4);
        end;
      end;
      if Task^.Proxytype = 0 then begin //HTTP(s)
        HTTP.ProxyParams.ProxyServer      := ProxyHost;
        HTTP.ProxyParams.ProxyPort        := ProxyPort;
        if Task^.ProxyAuth then begin
          HTTP.ProxyParams.ProxyUsername  := ProxyUsername;
          HTTP.ProxyParams.ProxyPassword  := ProxyPW;
        end;
      end;
      if (Task^.Proxytype = 1or (Task^.Proxytype = 2then begin   // Socks 4 or 5
        SSL.TransparentProxy := TIdSocksInfo.Create(HTTP);
        (SSL.TransparentProxy as TIdSocksInfo).Port             := ProxyPort;
        (SSL.TransparentProxy as TIdSocksInfo).Host             := ProxyHost;
        if Task^.ProxyAuth then begin
          (SSL.TransparentProxy as TIdSocksInfo).Username       := ProxyUsername;
          (SSL.TransparentProxy as TIdSocksInfo).Password       := ProxyPW;
          (SSL.TransparentProxy as TIdSocksInfo).Authentication := saUsernamePassword;
        end else begin
          (SSL.TransparentProxy as TIdSocksInfo).Authentication := saNoAuthentication;
        end;
        if (Task^.Proxytype = 1then  (SSL.TransparentProxy as TIdSocksInfo).Version := svSocks4;
        if (Task^.Proxytype = 2then  (SSL.TransparentProxy as TIdSocksInfo).Version := svSocks5;
      end;


Würde mich über Hilfe freuen