title: Webview HTTPS handshake failed
body: <p>I'm trying to access a website from an Android application with WebView library, so I have:</p>
  
  <pre><code>import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.webkit.SslErrorHandler;
  import android.webkit.WebSettings;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          WebView myWebView = (WebView) findViewById(R.id.webview);
          WebSettings webSettings = myWebView.getSettings();
          webSettings.setJavaScriptEnabled(true);
          webSettings.setDomStorageEnabled(true);
          webSettings.setUseWideViewPort(true);
          webSettings.setLoadWithOverviewMode(true);
          webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
          myWebView.setWebViewClient(
                  new SSLTolerentWebViewClient()
          );
          myWebView.loadUrl("https://www.mywebsite.ro");
      }
  }
  class SSLTolerentWebViewClient extends WebViewClient {
      @Override
      public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
          if (error.toString() == "piglet")
              handler.cancel();
          else
              handler.proceed(); // Ignore SSL certificate errors
      }
  }
  </code></pre>
  
  <p>In debug I have:</p>
  
  <blockquote>
    <p>D/OpenSSLLib: OpensslErr:Module:20(119:258); file:external/openssl/ssl/s23_clnt.c ;Line:714;Function:ssl23_get_server_hello</p>
    
    <p>W/chromium: external/chromium/net/socket/ssl_client_socket_openssl.cc:171 [0209/105028:WARNING:ssl_client_socket_openssl.cc(171)] Unmapped error reason: 258</p>
    
    <p>E/chromium: external/chromium/net/socket/ssl_client_socket_openssl.cc:792 [0209/105028:ERROR:ssl_client_socket_openssl.cc(792)] handshake failed; returned -1, SSL error code 1, net_error -2</p>
    
    <p>D/chromium/tcp: LogConnectCompletion with error:-2</p>
    
    <p>D/WebRequest: request error: -2</p>
    
    <p>D/chromium: Unknown chromium error: -2</p>
    
    <p>V/webview: setCertificate=null</p>
    
    <p>V/webcore: setupViewport mRestoredScale=0.0 mViewScale=2.0 mTextWrapScale=2.0 data.mScale= 2.0</p>
    
    <p>V/webcore: viewSizeChanged w=360; h=559; textwrapWidth=360; scale=2.0</p>
    
    <p>D/skia: Flag is not 10</p>
  </blockquote>