title: idHttp : error 500 internal server when site is https
body: <p>I am working on a project involving login and download, for more than 20 site, in some cases, the sites are very alike, even their structure is the same<br>
  i have encountered a problem recently, some of the same structured sites are <code>http</code> and some are <code>Https</code>, the <code>Http</code> ones are ok and work fine but the <code>Https</code> ones at the very first <code>post</code> return an error <code>500 internal server</code> when i try to login, the response code shows </p>
  
  <blockquote>
    <p><code>for security reasons you can not access ...</code>  </p>
  </blockquote>
  
  <p><strong>do i need to change my approach with <code>https</code> sites ? how can i fix this ?</strong><br>
  <strong>my code :</strong>   </p>
  
  <pre><code>mIdHttp := TIdHttp.create(nil);
  mIdHttp.AllowCookies := true;
  mIdHttp.HandleRedirects := true;
  mIdHttp.Request.Charset := 'utf-8';
  requestList.add('the post info from http analyzer');
  mIdHttp.post('site login url', requestList, responseCode); // error happens here
  </code></pre>
  
  <p><em>for privacy reasons i can not share the url for any of the sites</em><br>
  <strong>Edit :</strong><br>
  i did what was suggested about setting handler  </p>
  
  <pre><code>LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  mIdHttp.IOHandler:=LHandler;  
  </code></pre>
  
  <p>but it didn't work! (i also downloaded the two dll)  </p>
  
  <p><strong>New development :</strong><br>
  i just noticed the windows internet explorer cant open the site either!! and it returns an error :  </p>
  
  <pre><code>Turn on TLS 1.0, TLS 1.1, and TLS 1.2 in Advanced settings and try connecting to somesite.com  again. If this error persists, contact your site administrator.  
  </code></pre>
  
  <p>i think the <strong>certificate for the site is a fake</strong>, and if i go to the setting and uncheck the  </p>
  
  <pre><code>check for publisher certifcate revocation  
  </code></pre>
  
  <p>option in internet explorer, the site opens!, is this the reason i'm getting an error ? <strong>how can i do the same to idHttp</strong> ?  </p>
  
  <p><strong>Edit 2 (A New Site):</strong><br>
  <em>because the problem with this site is very similar to the previous one, i decided <strong>not to create a new question</strong> for this</em>  </p>
  
  <p>I'm getting an error <code>500</code> with a new site , when i try to manually go to the site and login i get an <code>This Connection is Untrusted</code> error in firefox and similar error in other browsers here is a picture o the firefox error :<br>
  <a href="https://i.stack.imgur.com/y651i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y651i.png" alt="enter image description here"></a></p>
  
  <p>I have already tried  </p>
  
  <pre><code>LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  //LHandler.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
  LHandler.OnVerifyPeer := OnVerifyPeer;
  mIdHttp.IOHandler := LHandler;  
  
  function OnVerifyPeer(certificate: TIdX509; AOk: Boolean; Adepth:Integer; AError: Integer): boolean;
  begin
    Result := true;
  end;
  </code></pre>
  
  <p>but i still get the same error<br>
  i also should mention that in this particular case, using <code>idHttp.Get</code> <strong>does not</strong> cause any error, the error happens when i trying to <code>Post</code> for login.<br>
  one more thing, i use both <code>httpAnalyzer</code> and <code>fiddler</code>, but none of them can pick up the site <code>posts</code> or <code>gets</code> when i run my program (they <strong>only</strong> don't work when i use my program and i try to <code>post</code>and <code>get</code> for this particular site).</p>