title: IdHTTP + SOCKS + Socks5
body: <p>I'm getting a general Indy error when using the <code>IdHTTP</code> client component in
  conjunction with a <code>SOCKS5</code> proxy server and using <code>SSL</code>.</p>
  
  <ul>
  <li>If I use the <code>IdHTTP</code> component with my <code>SOCKS5</code> proxy (and a non https URL),
  everything works without problems.</li>
  <li>If I use the <code>IdHTTP</code> component with an SSL URL (and no <code>SOCKS5</code> proxy),
  everything works without problems.</li>
  <li>If I use the <code>IdHTTP</code> component with an SSL URL and a <code>SOCKS5</code> proxy i get following error:</li>
  </ul>
  
  <p><code>Line 405</code> of the error output 
  <code>idSocks.pas</code> <code>(raise EIdSocksServerGeneralError.Create(RSSocksServerGeneralError);</code></p>
  
  <p>Here is my code</p>
  
  <pre><code>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 &gt;= 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 = 1) or (Task^.Proxytype = 2) then 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 = 1) then  (SSL.TransparentProxy as TIdSocksInfo).Version := svSocks4;
          if (Task^.Proxytype = 2) then  (SSL.TransparentProxy as TIdSocksInfo).Version := svSocks5;
        end;
  </code></pre>
  
  <p>Did I miss something or is it not possible to connect to a a SSL site with a Socks5 Proxy?</p>