Problem with cohttp 6.3

Hello,

Trying to execute a code that was working before raise an exception ```Fatal error: exception Invalid_argument(“Failed to set protocol version”)```.

Tracking the problem, it comes from a simple ```Cohttp_lwt_unix.Client.get```call.

Restarting from the tutorial for a simple get of the cohttp README. I get exactly the same error. I use opam with:

cohttp (6.3.0), cohttp-lwt (6.3.0), cohttp-lwt-unix (6.3.0), tls-lwt (2.1.3)

Can anyone may point me to the possible source of such a problem?

Thanks in advance

Hi @fdagnat,

It would seem you are hitting an issue whereby conduit is selecting the non-“native” SSL backend (i.e. using lwt_ssl alongside the ssl bindings) which is where that exception is being raised: ocaml-ssl/src/ssl_stubs.c at 2f36b4d50632261d309af7d2e749a4025ad3c167 · savonet/ocaml-ssl · GitHub.

To immediately see if this is the issue, you can try running your code with CONDUIT_TLS=native which should select the pure OCaml TLS stack. Alternatively, you could uninstall lwt_ssl and ssl too.

Copying in @toots who I think maintains the SSL bindings library. It might be worth opening an issue with more information on the bindings @fdagnat.

Hello,

Thanks for the hint. Indeed, removing lwt_ssl solves the problem.

But, if lwt_ssl is installed, setting the CONDUIT_TLS environment variable to native still raises the exception.

I am going to open an issue on the lwt_ssl github repo.