Open bryphe opened 4 years ago
What about using the existing libuv ocaml bindings ? https://github.com/aantron/luv
What about using the existing libuv ocaml bindings ? https://github.com/aantron/luv
That's absolutely an alternative, I believe Luv is already used in Oni2. For a viable HTTP(S)-client we'd need to hook it up with something like ocaml-tls. 🙂
Definitely - luv
+ a http
/https
client built on-top would be perfect
@bryphe and I discussed using ocurl
the other day as a solution to this problem.
Pros
libcurl
is very robustocurl
seems to be a thin wrapper on top of libcurl
ocurl
contains functions that integrate with Lwt
Cons
luv
integrationesy-libcurl
I'm going to investigate how hard it would be to write an luv
wrapper on top of the existing ocurl
code. I think it would be fairly similar to the Lwt
code 🤞
I made this as a proof of concept: https://github.com/zbaylin/ocurl-luv-test -- the only issues I'm running into as of now is converting a Unix.file_descr
to an Luv.Os_fd.Socket.t
. Unfortunately, Obj.magic
doesn't seem to work and the Unix
tools were removed from Luv
in order to not depend on Unix
. Once I find a fix I think ocurl
will definitely be a viable option for this!
Awesome progress @zbaylin !
Unfortunately, Obj.magic doesn't seem to work and the Unix tools were removed from Luv in order to not depend on Unix
I wonder if we can bring these back in a fork, or just in Revery?
@lessp has done some awesome work in pioneering a fetch API for us through https://github.com/lessp/fetch
Unfortunately, we can't use it in Onivim 2 yet - I would love to be able to, because we could remove this node-script-shim that we have today: https://github.com/onivim/oni2/blob/63e3159b0f45bed017251e4f35465bcb383a1b50/src/Service/Net/Service_Net.re#L69
There are a couple of blockers: 1) We need to ensure the fetch strategy works on Windows (and has CI tests for it) 2) Ideally, the fetch strategy should use
libuv
as the back-end - I envision Revery / Onivim to use libuv as the event loop. Might be easier once there is alibuv
-lwt engine.