]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpadebug: Add option to ignore SSL errors
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 7 Jun 2013 14:27:10 +0000 (17:27 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 7 Jun 2013 17:21:00 +0000 (20:21 +0300)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpadebug/src/w1/fi/wpadebug/WpaWebViewActivity.java

index 70464393ed7b85c3b8aaab8dab08d6899815ba67..a7c54fc680c9d54ad00d0a8c4dbe74911f9e9420 100644 (file)
@@ -9,11 +9,15 @@
 package w1.fi.wpadebug;
 
 import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.res.Configuration;
+import android.net.http.SslError;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.Window;
+import android.webkit.SslErrorHandler;
 import android.webkit.WebChromeClient;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
@@ -110,5 +114,33 @@ public class WpaWebViewActivity extends Activity
                           description + " (URL=" + failingUrl + ")",
                           Toast.LENGTH_LONG).show();
        }
+
+       @Override
+       public void onReceivedSslError(WebView view, SslErrorHandler handler,
+                                      SslError error)
+       {
+           Log.d(TAG, "SSL error: " + error);
+
+           final SslErrorHandler h = handler;
+           AlertDialog.Builder alert = new AlertDialog.Builder(activity);
+           alert.setTitle("SSL error - Continue?");
+           alert.setMessage(error.toString())
+               .setCancelable(false)
+               .setPositiveButton("Yes", new DialogInterface.OnClickListener()
+                   {
+                       public void onClick(DialogInterface dialog, int id)
+                       {
+                           h.proceed();
+                       }
+                   })
+               .setNegativeButton("No", new DialogInterface.OnClickListener()
+                   {
+                       public void onClick(DialogInterface dialog, int id)
+                       {
+                           h.cancel();
+                       }
+                   });
+           alert.show();
+       }
     }
 }