ocaml-cohttp
ocaml-cohttp copied to clipboard
Blocking Unix implementation of IO module?
I'm wondering if there'd be interest in a contribution consisting of a blocking Unix implementation for the IO module. This could be useful for testing out functorized Cohttp code without committing to Async or Lwt.
+1 this would be very useful
Initial implementation can be found on the unix branch of the inhabitedtype fork. This depends on the unix branch of ocaml-conduit.
None of this is tested, nor is it complete. But will be before pull requests fly. If anybody has comments let me know.
Looks good to me. /cc @djs55 who wanted something similar -- a non-Lwt one that read things byte-by-byte so that it could be fd-passed to another process once the HTTP header had been read.
Btw, why
type +'a t = Id of 'a
instead of
type +'a t = unit
?
@avsm I couldn't use unit because if I did, then read operations couldn't return results. Perhaps you meant something like this instead?
type +'a t = 'a
I tried that but ran into a type prettyprinting bug in the compiler similar to this one reported by @agarwal. Just to sidestep that issue and get things moving along, I added the variant.
I'll write the server code next and send pull requests to conduit and cohttp.
Are there any plans to continue/revive this? It would be very nice to have a Unix-based cohttp available.
@lindig was looking for something like this some times ago
I would be interested in this, too.
@seliopou do you still have a copy of that branch somewhere?