This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Basically I have a web-based spider, that works just like any other spider. One problem though � it won�t spider SSL pages that have untrusted certificates. So I was thinking of a good way to make it trust ALL the certificates (since it uses the URL class to read the pages)
So, I researched it and found an �old-fashioned� way to do this � by overriding TrustManager, and making it trust everything, and saving it in SSLContext or something. Basically, it would look like this:
Custom socket factory:
And here�s the sample code that I would use to test this:
The only �real� piece here is the �Security.setProperty�, which sort of replaces default socket factory with my crappy implementation.
I believe this used to work back on 1.4.2, but I am running 1.5, and here�s the problem that I get when executing the following code:
Any thoughts on how I could fix the �HttpsClient� to make it accept invalid certificates? Going back to 1.4.2 is not an option�
Thanks in advance for your help.
________________________________________ Best Regards,