aforarup / android-query

Automatically exported from code.google.com/p/android-query
0 stars 0 forks source link

Get a valid error for invalid/self-signed HTTPS certificate (it returns -101 Network error ) #146

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Connect to a server which is https along with self-signed certificate or 
invalid certificate.
2.
3.

What is the expected output? What do you see instead?
It should throw SSLHandshakeException

What version of the product are you using? On what operating system?
android-query.0.25.10.jar on Android 4.2.2

Please provide any additional information below.
I have two local server one with valid SSL Certificate and another with 
sefl-signed certificate.

I need to show dialog(The site's security certificate is not trusted!) and ask 
user to proceed.

Currently I use HTTPSURLCONNECTION class to determine, it will be helpful if 
aquery too give this exception. 

Original issue reported on code.google.com by nishant....@raweng.com on 25 Jun 2013 at 9:46

GoogleCodeExporter commented 8 years ago
Hi,

I have added a block of code in my AQUERY library.

com.androidquery.callback.AbstractAjaxCallback  

networkWork() method

in catch block

catch(Exception e){
   AQUtility.debug(e);
      if(e.getClass().equals(SSLPeerUnverifiedException.class)){
      //e.getMessage()  :-  No peer certificate
      //e.getClass  :-  class javax.net.ssl.SSLPeerUnverifiedException
      status.code(AjaxStatus.NETWORK_ERROR).message(e.getMessage());
   }else{
      status.code(AjaxStatus.NETWORK_ERROR).message("network error");
   }
}

Original comment by nishant....@raweng.com on 23 Jul 2013 at 11:50