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

HTTP package

Open anmonteiro opened this issue 3 years ago • 8 comments

Love the idea of the new upcoming http package. It has types that we could share across HTTP implementations in the OCaml ecosystem.

How feasible would it be to pull the parser parts out of this package though, and have it contain mostly types?

anmonteiro avatar Jan 30 '22 23:01 anmonteiro

What would be the advantage? The parser is not part of the public interface and requires no additional dependencies. The only gain would be to shave off the size of binaries by a little bit. Is that worth it?

rgrinberg avatar Jan 31 '22 00:01 rgrinberg

The only gain would be to shave off the size of binaries by a little bit. Is that worth it?

That was the rationale behind my suggestion.

anmonteiro avatar Jan 31 '22 00:01 anmonteiro

Alright, feel free to send a PR that moves the parser into a separate library (within the same package) if you really need this.

rgrinberg avatar Jan 31 '22 00:01 rgrinberg

I don't "really need this". I think the benefit here would be the ability to share those type representations across the ecosystem. If this is not as welcome as I anticipated, I'm OK sticking with the status quo.

anmonteiro avatar Jan 31 '22 00:01 anmonteiro

I think the benefit here would be the ability to share those type representations across the ecosystem

Is this benefit not already realized?

If this is not as welcome as I anticipated, I'm OK sticking with the status quo.

It's not that it's not welcome, it's just a bit too much of a niche feature for me to invest time in.

rgrinberg avatar Jan 31 '22 00:01 rgrinberg

Is this benefit not already realized?

I'd imagine an HTTP library that's going to implement its own parser not to need to bring in another one.

it's just a bit too much of a niche feature for me to invest time in.

This makes sense. I'll see if I can spend some of my own time on this soon.

anmonteiro avatar Jan 31 '22 00:01 anmonteiro

Sure there's a bit of redundancy but I claim that it's mostly harmless. OCaml binaries aren't very nimble after all.

By the way, give our http parser a try. It's hand written and is faster than httpaf's.

rgrinberg avatar Jan 31 '22 00:01 rgrinberg

With cohttp-eio, http is almost enough ... except for Cohttp.Path.resolve_local_file. It would be nice if Http had this.

A solution would be to move that function (of the Path module) to Uri ?

craff avatar Dec 07 '22 20:12 craff