ocaml-cohttp icon indicating copy to clipboard operation
ocaml-cohttp copied to clipboard

Blocking Unix implementation of IO module?

Open seliopou opened this issue 10 years ago • 8 comments

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.

seliopou avatar Jan 14 '15 19:01 seliopou

+1 this would be very useful

rgrinberg avatar Jan 14 '15 20:01 rgrinberg

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.

seliopou avatar Jan 16 '15 05:01 seliopou

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 avatar Jan 18 '15 22:01 avsm

@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.

seliopou avatar Jan 25 '15 15:01 seliopou

Are there any plans to continue/revive this? It would be very nice to have a Unix-based cohttp available.

hcarty avatar Jun 21 '16 13:06 hcarty

@lindig was looking for something like this some times ago

mseri avatar Oct 22 '18 09:10 mseri

I would be interested in this, too.

lindig avatar Oct 22 '18 10:10 lindig

@seliopou do you still have a copy of that branch somewhere?

mseri avatar Oct 23 '20 18:10 mseri