title: libcurl with OpenSSLUnknown SSL protocol error in connection - (no Server Hello) - why?
body: <p>I am working on an app that needs to talk to different HTTPS servers.  There are cases where server simply ignore SSL/TLS Client Hello (no Server Hello is returned).  </p>
  
  <p>The problem would exhibit itself in code as such: </p>
  
  <pre><code>&gt;curl32.exe -v -k --tlsv1 https://...
  * timeout on name lookup is not supported
  * About to connect() to &lt;server&gt; port 443 (#0)
  *   Trying &lt;IP&gt;...
  * connected
  * Connected to &lt;server&gt; (&lt;IP&gt;) port 443 (#0)
  * successfully set certificate verify locations:
  *   CAfile: ./cacert.test.pem
    CApath: none
  * Unknown SSL protocol error in connection to &lt;Server&gt;:443
  
  * Closing connection #0
  ===&gt; CURLcode is: 35
  </code></pre>
  
  <p>The returned code is: CURLE_SSL_CONNECT_ERROR</p>
  
  <p>When running from OpenSsl directly, this would be ok: </p>
  
  <pre><code>OpenSSL&gt; s_client -tls1 -connect &lt;server&gt;:443
  </code></pre>
  
  <p>I have tried various combination (specify TLS, SSL or not specify).  The only common thing when problem happens is when the SSL/TLS version is inconsistent.  So in WireShark I will see, under TCP, Secure Socket Layer:</p>
  
  <ul>
  <li>SSL Record Layer: Handshake Protocol: Client Hello  &lt;===
  <ul>
  <li>Version: TLS 1.0 (0x0301)</li>
  <li>...</li>
  <li>Handshake Protocol: Client Hello
  <ul>
  <li>...</li>
  <li>Version: TLS 1.0 (0x0301)</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>In the correct case where I will see Server Hello from server I will see: </p>
  
  <ul>
  <li>TLSv1 Record Layer: Handshake Protocol: Client Hello  &lt;===
  <ul>
  <li>Version: TLS 1.0 (0x0301)</li>
  <li>...</li>
  <li>Handshake Protocol: Client Hello
  <ul>
  <li>...</li>
  <li>Version: TLS 1.0 (0x0301)</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>I am not completely sure it is the libcurl issue, or maybe the WireShark is not decoding it correctly (as the Record Layer in both cases look almost identical, and the 2 Version fields are correct), making libcurl appears to be the problem.</p>
  
  <p>Any thoughts?  Ideas?  Similar experience?  Any help much appreciated!!</p>