mrmike/Ok2Curl

It doesn't add the "--insecure" flag

Closed this issue · 2 comments

When I'm using OkHttp with a NetworkInterector that has a SSLSocketFactory factory that skips the SSL certificate validation and the hostname verification, it doesn't add the "--insecure" flag to the Curl command.

You can see an example on this StackOverflow question: http://stackoverflow.com/questions/25509296/trusting-all-certificates-with-okhttp

Hi @rullopat

Thanks for reporting issue. I will take a look on it.

Hi @rullopat

Since version 0.4.0 Ok2Curl support curl options and insecure is one of them.

You can use it like in the following code

final Options options = Options.builder()
                .insecure
                .build();

final CurlInterceptor interceptor = new CurlInterceptor(logger, options);

It will simply add --insecure to every curl command. I've done it this way because and not through checking specific SSLSocketFactory because I want to have Ok2Curl as generic as possible and checking for socket factory and adding insecure flag based on that would be a very specific thing to do.

If you find any issues please let me know.