title: OpenSSL connection error SSL23_GET_SERVER_HELLO, but browser and curl works
body: <p>I'm dealing with an issue where python can't connect to a specific server over ssl due to openssl not being able to complete the handshake. Curl and my browser work. I've tried a couple of different openssl versions and <a href="https://stackoverflow.com/questions/30538542/tlsv1-alert-internal-error-during-handshake">solutions</a>, but can't seem to connect.</p>
  
  <p>Here is what I've tried on both of the following platforms. The output is printed slightly different on OpenSSL 1.0.1e, but it's still the same errors. </p>
  
  <pre><code>Mac OSX Yosemite - OpenSSL 0.9.8zg 14 July 2015
  Debian GNU/Linux 7 (wheezy) - OpenSSL 1.0.1e 11 Feb 2013
  </code></pre>
  
  <p>Without specifying which version of </p>
  
  <pre><code>openssl s_client -connect www.uk-recruitment.net:443
  openssl s_client -connect www.uk-recruitment.net:443 -cipher 'DEFAULT:!ECDH'
  openssl s_client -connect www.uk-recruitment.net:443 -CAfile cacert.pem
  openssl s_client -connect www.uk-recruitment.net:443 -CAfile cacert.pem -cipher 'DEFAULT:!ECDH'
  openssl s_client -connect www.uk-recruitment.net:443 -CAfile cacert.pem -cipher 'DEFAULT:!ECDH' -servername uk-recruitment.net
  </code></pre>
  
  <p>but I always get the same result</p>
  
  <pre><code>CONNECTED(00000003)
  66716:error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error:/SourceCache/OpenSSL098/OpenSSL098-52.40.1/src/ssl/s23_clnt.c:593: 
  </code></pre>
  
  <p>If I add <code>-tls1</code>, <code>-tls1_1</code> or <code>-tls1_2</code> with all the same options, I get a slightly different error:</p>
  
  <pre><code>openssl s_client -connect www.uk-recruitment.net:443 -tls1
  CONNECTED(00000003)
  66750:error:14094438:SSL routines:SSL3_READ_BYTES:tlsv1 alert internal error:/SourceCache/OpenSSL098/OpenSSL098-52.40.1/src/ssl/s3_pkt.c:1145:SSL alert number 80
  66750:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure:/SourceCache/OpenSSL098/OpenSSL098-52.40.1/src/ssl/s3_pkt.c:566:
  </code></pre>