Making part of HttpClient behave like WebView

by Matthew1471 » Thu, 03 Mar 2011 04:27:48 GMT


Sponsored Links
 Hello!

I observe the web-browser allows you to view dodgy SSL certificates
(and cancel/ignore) for https sites that self sign. The built-in HTC
Mail application provides similar functionality when you use IMAPS.

So after downloading the browser (and then webkit) source from git I
have found all the bits I would want to implement in my HttpClient
based program:

CallbackProxy.java:
...case SSL_ERROR:
                ...
                    mWebViewClient.onReceivedSslError(mWebView,
                            (SslErrorHandler) map.get("handler"),
                            (SslError) map.get("error"));
                ...


and

...public void onReceivedSslError(SslErrorHandler handler, SslError
error) {
        ...
        if (mWebViewClient == null) {
            handler.cancel();
            return;
        }
        ....
    }...

Where handler.cancel() stops the site from running and
handler.proceed() allows it to continue (SslError contains both the
error and certificate that caused it).

How can I make the *Apache HttpClient* pass an event that allows the
user to view the certificate and ignore or continue (with the view to
databasing any allowed exceptions). Surely WebKit uses the HttpClient
behind the scenes so a method to register for call-back events such as
onRecievedSslError must exist?

I know, yes, you can implement your own trustedstore (I want my users
to connect to their own servers) or even your own SSLSocketFactory (to
over-ride checkServerTrusted etc) I do not feel brave enough to want
to do that, I would rather let the phone decide it is invalid and then
let the user over-ride it rather than forget to implement a crucial
check and risk making the SSL completely pointless.

Any help on how to get the HttpClient into that handler.cancel or
handler.proceed state would be much appreciated.

Thanks for your time,
Matthew

-- 



Other Threads

1. Kindly unsubscribe my id ram...@agilees.com

Regards,

Ramesh Edessary

Phone: 630 242 3952 x 208||Fax: (630) 206-2397||Email:ram...@agilees.com

Agile Enterprise Solutions, Inc|| Ensuring Client's success||www.agilees.com

Great spot for recruiter/consultants- Join
-http://www.linkedin.com/groups?about=&gid=2034599&trk=anet_ug_grppro

"The quality of life reflects the quality of the questions we ask ourselves"

Note: If you have received this mail in error or prefer not to receive such
emails in the future, please reply with "REMOVE" in the subject line and the
email id(s) to be removed. All removal requests will be honored ASAP. We
sincerely apologize for any inconvenience caused.

 P Before printing, think about the environment 

Disclaimer: This document is intended for transmission to the named
recipient only. If you are not that person, you should note that legal
rights reside in this document and you are not authorized to access, read,
disclose, copy, use or otherwise deal with it and any such actions are
prohibited and may be unlawful. The views expressed in this document are not
necessarily those of Agile Enterprise Solutions, Inc. Notice is hereby given
that no representation, contract or other binding obligation shall be
created by this e-mail, which must be interpreted accordingly. Any
representations, contractual rights or obligations shall be separately
communicated in writing and signed in the original by a duly authorized
officer of the relevant company

 

-- 

2. Android Mythbusters (Matt Porter)

I read it, to me it sounds like its' written by someone who doesn't  
understand the complexities of mobile 'phone development.

Flexibility costs. It costs in terms of storage, processing  
requirements, and battery life. I've yet to see a full Linux/GNU  
installation on a phone sized device that can run for 24 hours without  
a charge, and I doubt that it would be possible, but hey, I'm always  
willing to be proven wrong if you can provide me with an example....

(and before anyone says N900, even Nokia don't try to call it a  
smartphone, they call it a Mobile Computer).

Al.
--

* Looking for Android Apps? - Try http://andappstore.com/ *

======
Funky Android Limited is registered in England & Wales with the  
company number  6741909.

The views expressed in this email are those of the author and not  
necessarily those of Funky Android Limited, it's associates, or it's  
subsidiaries.




> 

3. Show pictures on maps moved location to nearest street address.

4. 2.0 Droid

5. Non-braodcasting wifi access points and "HiddenSSID Enabler"

6. Droid Eris Keypad settings

7. Access voice data while in call