httpmock icon indicating copy to clipboard operation
httpmock copied to clipboard

This library depends on OpenSSL

Open FalkWoldmann opened this issue 2 years ago • 10 comments

Hi,

it seems like this lib depends on OpenSSL being installed on the host system because of the Isahc crate, which itself depends on OpenSSL. It would be nice to introduce a rustls flag so that users do not need to setup OpenSSL on their build systems.

FalkWoldmann avatar Jun 15 '23 08:06 FalkWoldmann

Just noticed the same thing. Would be nice to have a rustls flag to avoid an openssl dependency (however, it doesn't look like isahc supports it...).

aldanor avatar Jun 15 '23 15:06 aldanor

@FalkWoldmann , @aldanor Thanks for reaching out. There is already PR #72, but it is blocked by an upstream PR. Do you think it may solve your issue once merged?

alexliesenfeld avatar Jun 19 '23 20:06 alexliesenfeld

Also upvoting this as I spent some effort to make my app not depend on openssl.

lcmgh avatar Jun 22 '23 15:06 lcmgh

@alexliesenfeld Yes this should do it, thanks. However it doesn't look like https://github.com/sagebind/isahc/issues/199 will be merged anytime soon (not earlier than autumn this year according to author)...

aldanor avatar Jun 23 '23 14:06 aldanor

Would it be possible to migrate to another http client like reqwest?

FalkWoldmann avatar Sep 19 '23 13:09 FalkWoldmann

ureq is already a dev-dep and could probably replace isahc. i ran into the same trying to write tests for a program on openbsd and compilation fails.

maybe make isahc use a feature or removed instead and let user choose their own client @alexliesenfeld ?

labannah9125 avatar Oct 04 '23 19:10 labannah9125

Hi @FalkWoldmann and @labannah9125,

Thank you for your input. After reflecting on the proposed change, I have a few thoughts:

  • When httpmock is used as a library only (not for connecting to a remote mock server using MockServer::connect and the like), we can eliminate the need for a real HTTP client altogether. This not only addresses the TLS issues but also reduces the dependency tree by approximately 80 crates!
  • Some users reported they also use httpmock as a standalone mock server behind proxies and other infrastructure (like Kubernetes), which may be SSL-enabled. This still requires a real HTTP client i.m.o. For this scenario, I want to hold off until the isahc upstream PR gets merged, as my experience with isahc has been very positive so far. However, to opt into using isahc, users need to enable the “remote” feature flag, which will only be used to connect to remote mock servers. As a consequence, functions like MockServer::connect, MockServer::connect_async, and MockServer::connect_env will only be available when the “remote” feature is turned on.

Please note that this represents a breaking change, but it should not be a problem for most users.

I hope this solves your problems.

alexliesenfeld avatar Oct 15 '23 08:10 alexliesenfeld

Released version 0.7.0-rc.1 with the discussed changes. Let me know if this solves your problem.

alexliesenfeld avatar Oct 15 '23 19:10 alexliesenfeld

Looks good to me, thanks!

FalkWoldmann avatar Oct 26 '23 09:10 FalkWoldmann

@FalkWoldmann Nice! Thanks for letting me know.

alexliesenfeld avatar Oct 26 '23 16:10 alexliesenfeld