Override always default Android hostname verifier
This fixes the following problem:
javax.net.ssl.SSLPeerUnverifiedException: Hostname WWW.XXX.YYY.ZZZ not verified:
... ...
subjectAltNames: [] ; Zone: <root> ; Task: Promise.then ; Value: javax.net.ssl.SSLPeerUnverifiedException: Hostname WWW.XXX.YYY.ZZZ not verified:
A couple of months ago, Android stopped accepting self-signed certificates without SAN value when performing a WS call. I took a look at nativescript-https's code and there's this option validatesDomainName: if false, it uses default Android hostname verification which throws the mentioned error; if true, it uses a custom hostname verifier.
With my proposed change, the custom verifier will always be used, but it will return true if validatesDomainName === false and will use current logic if validatesDomainName === true. This can be returned some lines before, just at the beginning of verify and save some processing, but I think it looks fancier this way. I'll modify the code if needed.
I used this for a development environment and I thought it was useful since I saw some people having the same problem. I think this could be useful for someone else.
Best regards from _travelDevs.
Hey @roblav96! Any chance for this to get merged?
Thanks in advance.
@Guatom You mentioned, that Android requires a SAN value for self-signed certificates. I can't find any information or documentation for this. Do you by any chance have a source for this info? Thanks in advance!
@jjonly sorry my friend! I don't know why I hadn't been notified about this. Do you still need help?