http
http copied to clipboard
Support badCertificateCallback in cronet
It's quite common in larger business intranets that connections are only secured by self-signed certificates. To enable secure communication inside such networks, we're currently relying on HttpClient's badCertificateCallback.
That works well - but for http2 support and honoring of proxies set on device level, we would like to switch to cronet for Android. However, in our tests, the badCertificateCallback is never invoked. Instead attempted requests simply fail with a ClientException:
ClientException: Cronet exception: m.mb: Exception in CronetUrlRequest: net::ERR_CERT_AUTHORITY_INVALID, ErrorCode=11, InternalErrorCode=-202, Retryable=false, uri=https://self-signed.badssl.com/
Is it possible to support the badCertificateCallback with cronet? Or is there an alternative way to accept self-signed certificates?
I don't think that is possible using the cronet API