http - Java okhttp issues in redirect count and domain cert -
i have 3 issues when use okhttp content these web sites:
http://www.wp.com has error with: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target
http://www.macys.com has error with: java.net.protocolexception: many follow-up requests: 21
http://www.vk.me has error with: javax.net.ssl.sslpeerunverifiedexception: hostname www.vk.me not verified: certificate: sha256/sx09combybyu6gdls0e6dayldvlydbmjjfnktanfsg4= dn: cn=.vk.com, ou=domain control validated subjectaltnames: [.vk.com, vk.com]
updated @ 2016/06/12:
- http://www.wordpress.com has error with: javax.net.ssl.sslhandshakeexception: remote host closed connection during handshake
how fix above issues 1-4? all!
given sites have not been compromised:
(1) missing root-ca certificate in trusted store. can happen, if ca used website not delivered jdk. need manually add in trusted store using keytool.
(2) researched error , found, thrown okhttp client, if receives more 20 redirect requests. source this: https://github.com/square/retrofit/issues/1561
update: did browser load page trace macys.com. impressive, should give experience :-) redirects normal load behavior of page, font redirected zillions of times.
okhttp implements max redirect value of 20 hardcoded value. https://github.com/square/okhttp/blob/master/okhttp/src/main/java/okhttp3/internal/http/httpengine.java (line 91)
(3) domain name in certificate not match certificate presented. common error on multihomed pages.
to fix (1), besides adding ca, implement java ssl certificate path validator described here http://docs.oracle.com/javase/7/docs/technotes/guides/security/certpath/certpathprogguide.html#validationclasses
to fix (3) need implement trustmanager described here ssl certificate verification in java
Comments
Post a Comment