title: Simple TIdHttpServer Example supporting SSL
body: <p>Hoping someone can provide me a simple <strong>TIdHttpServer</strong> example which supports SSL.  Using Delphi2007 and Indy10.  I have the following to create/setup the server and ioHandler:</p>
  
  <pre><code>ServerIOHandler := TIdServerIOHandlerSSLOpenSSL.Create(self);
  ServerIOHandler.SSLOptions.CertFile := 'mycert.pem';
  ServerIOHandler.SSLOptions.KeyFile := 'mycert.pem';
  ServerIOHandler.SSLOptions.RootCertFile := 'mycert.pem';
  ServerIOHandler.SSLOptions.Method := sslvSSLv23;
  ServerIOHandler.SSLOptions.Mode := sslmServer;
  
  ServerIOHandler.SSLOptions.VerifyDepth := 1;
  ServerIOHandler.SSLOptions.VerifyMode := [sslvrfPeer,sslvrfFailIfNoPeerCert,sslvrfClientOnce];
  
  IdHTTPServer1 := TIdHTTPServer.Create;
  IdHTTPServer1.AutoStartSession := True;
  IdHTTPServer1.SessionState := True;
  IdHTTPServer1.OnCommandGet := IdHTTPServer1CommandGet;
  idHttpServer1.ParseParams := True;
  idHttpServer1.DefaultPort := 80;
  idHttpServer1.IOHandler := ServerIOHandler;
  IdHTTPServer1.Active := True;
  </code></pre>
  
  <p><strong>mycert.pem</strong> was created using openssl with this command:</p>
  
  <pre><code>openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
  </code></pre>
  
  <p>Right away I think there is something wrong because I am using the same file for <strong>CertFile, KeyFile, RootCertFile</strong>.  </p>
  
  <p>I entered blanks for prompts with the exception being the common name.  That I was sure to set to the domain name I am using (let's say hypothetically it is <strong>myexample.com</strong>).</p>
  
  <p>In a browser if I hit <strong>http://myexample.com</strong> results in exception: <strong>Error accepting connection with SSL</strong>.  Hitting <strong>https://myexample.com</strong> never makes it to my code.</p>
  
  <p><strong>January 30 NOTE</strong>  - I used sslbuddy to generate the keys.  And this still did not work.  I then commented out the following lines and it worked:</p>
  
  <pre><code>ServerIOHandler.SSLOptions.VerifyDepth := 1;
  ServerIOHandler.SSLOptions.VerifyMode := [sslvrfPeer,sslvrfFailIfNoPeerCert,sslvrfClientOnce];
  </code></pre>