-
Notifications
You must be signed in to change notification settings - Fork 122
Description
Hello there. First of all I want to congratulate you for such fine Library @vince-styling :) I have been struggling for days with alternatives and this one I tried and read and seems neat (although I don't know Chinese, the code is really self-explanatory).
Now, I am having an issue when providing my SSLSocketFactory to the HurlStack. The error I get reads (with xx on my sensible data):
javax.net.ssl.SSLPeerUnverifiedException: Hostname x.x.x.x not verified:
certificate: xxxx
DN: CN=xx.xx,O=xx,L=xx,ST=xx,C=xx
subjectAltNames: []
Before finding this great library, I successfully used my self-signed Certificate and was able to talk to my API via HTTPS, by setting it my SSLSocketFactory as done in the HurlStack. However, to be able to do that, I also had to specify a HostnameVerifier to the HttpsURLConnection. As of right now I pass my custom HostnameVerifier to the connection and it works ok.
Reading the source code, it seems to me that Netroid does not set a HostnameVerifier to the connection (as far as I understand, I could be wrong though), specifically on:
Netroid/library/src/main/java/com/vincestyling/netroid/stack/HurlStack.java
Lines 163 to 167 in 7e67a08
| if ("https".equals(url.getProtocol()) && mSslSocketFactory != null) { | |
| ((HttpsURLConnection) connection).setSSLSocketFactory(mSslSocketFactory); | |
| } | |
| return connection; |
What do you suggest I can do to overcome this situation, so I can set my own HostnameVerifier?
Thanks :)