Skip to content

Make it possible to tell if an OkHttpClient/Interceptor.Chain is using a non-default sslSocketFactory #9744

Description

@edechamps-Google

We would like to know, in an application interceptor, if the user is using a custom SSLSocketFactory, i.e. they called OkHttpClient.Builder.sslSocketFactory or Interceptor.Chain.withSslSocketFactory.

This is because, if the user is using the default SSL Socket Factory, our interceptor can use its own SSL implementation with little risk of contradicting the user's intent. The interceptor should ideally refrain from doing this if the user overrode the option.

Currently this doesn't really seem to be feasible. Indeed, if the user does not specify this option, OkHttp sets the field to a new instance, which means Interceptor.chain.sslSocketFactoryOrNull cannot be compared against null or some default instance.

@yschimke @vkasprov

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions