title: Requests.get fails even though a direct SSL connection works
body: <p>I have been playing around with HTTPS in C++ and have written a basic server. The server does not care about the request and only sends one possible reply. I tried to connect using the <code>get()</code> method of the Python <a href="https://requests.readthedocs.io/en/master/" rel="nofollow noreferrer"><code>requests</code></a> module to test my server. However this raised the error <code>certificate verify failed: unable to get local issuer certificate</code> on the client (python) side and <code>123145338105856:error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca:ssl/record/rec_layer_s3.c:1544:SSL alert number 48</code> on the server (C++) side. When I tried to connect using this code:</p>
  <pre class="lang-py prettyprint-override"><code>import socket, ssl
  
  s = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM), server_side = False)
  s.connect((&quot;website.com&quot;, 443)) # Not the actual website
  s.send(b'e') # As I mentioned, the server does not care about the request
  print(s.recv(16384))
  </code></pre>
  <p>or this code:</p>
  <pre class="lang-sh prettyprint-override"><code>openssl s_client -connect website.com:443 # Again, not the actual website
  </code></pre>
  <p>Everything went to plan.</p>
  <p>I have found that the error is raised in <code>SSL_accept()</code>. Here is some code from the server that i think is important:</p>
  <pre class="lang-cpp prettyprint-override"><code>// The SSL context initialiser
  
  SSL_CTX *ctx = SSL_CTX_new(SSLv23_server_method());
  
  if (!ctx)
      throw errors::SSLError();
  
  if (SSL_CTX_use_certificate_file(ctx, &quot;server.crt&quot;, SSL_FILETYPE_PEM) &lt;= 0)
      throw errors::SSLError();
  
  if (SSL_CTX_use_PrivateKey_file(ctx, &quot;server.key&quot;, SSL_FILETYPE_PEM) &lt;= 0 )
      throw errors::SSLError();
  
  this-&gt;ctx = ctx;
  this-&gt;fd = socket(AF_INET, SOCK_STREAM, 0);
  </code></pre>
  <pre class="lang-cpp prettyprint-override"><code>// The accept function
  
  SSL *ssl = SSL_new(this-&gt;ctx);
  SSL_set_verify(ssl, SSL_VERIFY_NONE, NULL);
  SSL_set_fd(ssl, accept(this-&gt;fd, (struct sockaddr *) this-&gt;addr, &amp;this-&gt;slen));
  
  if (SSL_accept(ssl) &lt;= 0) // This fails
      throw errors::SSLError(ssl);
  </code></pre>
  <p>Update: It works on the Safari browser too</p>