Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cohttp-eio Client module #879

Merged
merged 9 commits into from
Aug 27, 2022
Merged

cohttp-eio Client module #879

merged 9 commits into from
Aug 27, 2022

Conversation

bikallem
Copy link
Contributor

@bikallem bikallem commented Jun 9, 2022

This the client implementation of cohttp eio backend. Roughly, the PR aims to achieve the following (some are optional and/or outside the remit of this PR):

A couple of tasks above are optional since the PRs/dependencies are in other repositories. I will update the task with PRs and status as they are merged/accepted.

EDIT: ocaml-tls and ocaml-dns for cohttp-eio client tls and domain name resolution functionality will be resolved in future PRs when respective PRs to support eio backend are merged.

cohttp-lwt-jsoo/test/src/dune Outdated Show resolved Hide resolved
@mseri
Copy link
Collaborator

mseri commented Jun 9, 2022

Please rebase it on master. There seem to be spurious changes from an old eio-3 branch (like the shell-eio..nix file

@bikallem
Copy link
Contributor Author

bikallem commented Jun 9, 2022

Please rebase it on master. There seem to be spurious changes from an old eio-3 branch (like the shell-eio..nix file

Do you have a suggestion on how to go about the rebase? I tried git rebase master and there were lots of conflicts which I couldn't get my head around. So I just merged master on the branch.

@mseri
Copy link
Collaborator

mseri commented Jun 9, 2022

I can probably do it in a couple of days if that is ok.

I don’t know if it is the best way, but I usually do it manually by running interactive rebase. For each commit I reset, stage the relevant changes (for partial chunks, should not be the case here, there is gjt add -p). Then I drop everything else with git restore . and continue the rebase

@bikallem bikallem force-pushed the eio-client branch 2 times, most recently from d79e7e2 to 08e27b4 Compare June 10, 2022 12:08
@bikallem
Copy link
Contributor Author

I managed to rebase on master and remove all the unnecessary commits. git rebase -i master seems to be the trick in this case.

@bikallem bikallem force-pushed the eio-client branch 6 times, most recently from 65ad868 to 15a299e Compare June 12, 2022 10:41
Copy link

@patricoferris patricoferris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @bikallem, I'm using a slightly modified version over in https://github.com/geocaml/carbon-intensity :))

cohttp-eio/src/client.ml Outdated Show resolved Hide resolved
@bikallem bikallem force-pushed the eio-client branch 2 times, most recently from 70cb9f1 to eb8377e Compare July 25, 2022 12:55
@bikallem bikallem marked this pull request as ready for review July 25, 2022 13:01
@bikallem
Copy link
Contributor Author

bikallem commented Jul 25, 2022

@mseri The branch is now rebased on master and all todo items are addressed. It is ready for review.

Copy link
Contributor

@talex5 talex5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, get, post, etc take a URI and an open-ended set of resources that might be needed to connect to it. This is not very flexible, since it requires cohttp to define all possible connection methods. I think we should split this into two parts:

  1. A plain HTTP API where you pass in an already-connected Eio.Flow.two_way (plus the URI, for e.g. the "host" header).
  2. A high-level API for resolving URIs to resources. This will know about networks, TLS, DNS, etc. It might follow redirects too.

It's not clear to me that (2) should even be in this library, as it should also handle other protocols too (file://, ftp://, gemini://, etc). In Python, the urllib.request module handles that.

Perhaps we should put a Resolver in Eio, and let cohttp populate it, e.g. something like:

let r = Eio.Resolver.make () in
Resolver.register r "http"  @@ Cohttp_eio.http_resolver env;
Resolver.register r "https" @@ Cohttp_eio.https_resolver env;
let data = Resolver.resolve r uri in

There could also be a convenience function to do this in one go, of course.

@bikallem
Copy link
Contributor Author

bikallem commented Jul 26, 2022

@mseri The MacOS CI failing seems not related to this PR.

@bikallem
Copy link
Contributor Author

bikallem commented Aug 3, 2022

@talex5 Eio.Client makes do with Eio.Flow.two_way now.

@bikallem bikallem force-pushed the eio-client branch 2 times, most recently from af45c84 to 55f2293 Compare August 3, 2022 15:04
Copy link
Contributor

@talex5 talex5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I made a few comments on the interface inline.

cohttp-eio/src/client.ml Outdated Show resolved Hide resolved
Comment on lines 102 to 122
type 'a body_disallowed_call =
?version:Http.Version.t ->
?headers:Http.Header.t ->
Eio.Switch.t ->
Eio.Flow.two_way ->
resource_path ->
response
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'a isn't used here. But this would work (avoids the user having to cast things).

Suggested change
type 'a body_disallowed_call =
?version:Http.Version.t ->
?headers:Http.Header.t ->
Eio.Switch.t ->
Eio.Flow.two_way ->
resource_path ->
response
type 'a body_disallowed_call =
?version:Http.Version.t ->
?headers:Http.Header.t ->
(#Eio.Flow.two_way as 'a) ->
resource_path ->
response

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

cohttp-eio/src/cohttp_eio.mli Outdated Show resolved Hide resolved
cohttp-eio/examples/client1.ml Outdated Show resolved Hide resolved
@bikallem bikallem force-pushed the eio-client branch 3 times, most recently from fbe4d60 to 2d07352 Compare August 4, 2022 09:46
Copy link
Contributor

@talex5 talex5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@talex5 do you have further comments?

I found that some of the previous comments had been marked as resolved accidentally, so I unresolved them (it seems that GitHub lets you mark other people's comments as resolved for some reason).

I think it's mostly OK, but we should separate out connections from requests. Adding an example that sends two requests over one connection would probably make things clearer.

"/shop/items", "/shop/categories/" etc. *)

type ('a, 'b) conn = 'a -> (resource_path * host * #Eio.Flow.two_way as 'b)
(** [('a, 'b conn)] is [(resource_path, host, flow)]. [flow] is the Eio flow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(** [('a, 'b conn)] is [(resource_path, host, flow)]. [flow] is the Eio flow
(** [('a, 'b) conn] is [(resource_path, host, flow)]. [flow] is the Eio flow

However, this description does not match the type, which is still (strangely) a function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed 'a conn now. The are now passed directly to call as parameters. 7599e46

Comment on lines 145 to 146
('a, 'b) conn ->
'a ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
('a, 'b) conn ->
'a ->
'a conn ->

There is no point taking a function and its input here, as you just call it once immediately in all cases. It should just take the connection directly.

Copy link
Contributor Author

@bikallem bikallem Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 09c2d01

module Switch = Eio.Switch
open Cohttp_eio

let conn env sw port resource_path =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking resource_path here means that every time you want a different resource, you also need to open a new connection. Why not separate out the connection from individual requests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 09c2d01

match Uri.scheme uri with
| Some "http" -> `HTTP
| Some "https" -> `HTTPS
| Some _ -> raise (invalid_arg "uri: invalid uri scheme")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two common questions I had in the past are how to timeout requests and how to connect to unix domain sockets. Since with ocaml5+eio it is done differently, I think we should document it either in the interface, in an example to link to the README or in the README, so that we avoid answering the same questions all the time.

Regarding timeouts, Eio.Time.with_timeout should do it. However, an example might be nice, indeed.

cohttp-eio/src/body.ml Show resolved Hide resolved
Adde tests/demos both writing and reading chunked encoding in both client and
and server.
@bikallem bikallem force-pushed the eio-client branch 2 times, most recently from 7599e46 to 09c2d01 Compare August 25, 2022 16:03
@bikallem
Copy link
Contributor Author

@talex5

Regarding timeouts, Eio.Time.with_timeout should do it. However, an example might be nice, indeed.

I can't seem to be able to reply inline so creating a comment instead. This is now done in af9e2b5

@bikallem
Copy link
Contributor Author

@talex5 I think I have addressed all of the latest review comments. Could you please mark them as resolved if so.

RFC https://www.rfc-editor.org/rfc/rfc7230#section-3.3.3 point 7 states
that responses with missing Content-Length/Transfer-Encoding headers
should read the message body until the end of file.

This commit implements the above spec. Since now that read_fixed is
different in client and server, we also remove it from the Body module.
Copy link
Contributor

@talex5 talex5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. There are things can be still be improved here, but I don't see any problem with merging it as it is and then working on the main branch.

Comment on lines +126 to +133
type 'a body_allowed_call =
?version:Http.Version.t ->
?headers:Http.Header.t ->
?body:Body.t ->
conn:(#Eio.Flow.two_way as 'a) ->
host ->
resource_path ->
response
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is minor, but it might be worth putting the body argument first. Then it could be defined more simply as:

Suggested change
type 'a body_allowed_call =
?version:Http.Version.t ->
?headers:Http.Header.t ->
?body:Body.t ->
conn:(#Eio.Flow.two_way as 'a) ->
host ->
resource_path ->
response
type 'a body_allowed_call = ?body:Body.t -> 'a body_disallowed_call

(possibly renaming the types for clarity)

Copy link
Contributor Author

@bikallem bikallem Aug 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I did consider such a scheme but found that when reading such types it read as ... so a body_allowed_call is also a body_disallowed_call. It didn't quite roll off the tongue for me so I left it as it is even though it is a bit repetitive. Also I didn't want to introduce another level of indirection since the types are mostly for alias and clarity for the values below, i.e get, post, head, etc.

[n] if "Content-Length" header is a valid integer value [n] in [response].
[reader] is updated to reflect that [n] bytes was read. *)

val read_chunked : response -> (Body.chunk -> unit) -> Http.Header.t option
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean convert read data into Body.chunk ? Possibly could work. Let me see.

Yes. I don't see why the comment you linked is a problem for that:

  1. "read_chunked returns an updated set of headers" : just return the unmodified headers in the fixed case
  2. "Each chunk may have chunk extensions" : just return an empty set of extension for fixed bodies

Comment on lines +105 to +112
let read_fixed ((response, reader) : Http.Response.t * Buf_read.t) =
match
Http.Header.get response.headers "Content-Length"
|> Option.get
|> int_of_string
with
| content_length -> Buf_read.take content_length reader
| exception _ -> Buf_read.take_all reader
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't treat all errors (e.g. not-an-integer) as a missing content-length:

Suggested change
let read_fixed ((response, reader) : Http.Response.t * Buf_read.t) =
match
Http.Header.get response.headers "Content-Length"
|> Option.get
|> int_of_string
with
| content_length -> Buf_read.take content_length reader
| exception _ -> Buf_read.take_all reader
let read_fixed ((response, reader) : Http.Response.t * Buf_read.t) =
match Http.Header.get response.headers "Content-Length" with
| Some content_length -> Buf_read.take (int_of_string content_length) reader
| None -> Buf_read.take_all reader

Copy link
Contributor Author

@bikallem bikallem Aug 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't an invalid content-length value(integer) be understood as an invalid Content-Length header and be treated as such? Specifically,

  1. If a valid Content-Length header field is present without
    Transfer-Encoding, its decimal value defines the expected message
    body length in octets. If the sender closes the connection or
    the recipient times out before the indicated number of octets are
    received, the recipient MUST consider the message to be
    incomplete and close the connection.

I assumed the "invalid" in a broader sense, not just missing 'Content-Length' header. So this would be invalid: Content-length: abc since abc can't be a valid integer value in OCaml.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an interesting point. https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2 says:

Any Content-Length field value greater than or equal to zero is valid.

I think it's assuming that the value will always be an integer, though it's not clear. It's also unclear why negative values should be ignored - possibly some systems use that to indicate streaming?

The older https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html says:

When a Content-Length is given in a message where a message-body is allowed, its field value MUST exactly match the number of OCTETs in the message-body. HTTP/1.1 user agents MUST notify the user when an invalid length is received and detected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointers. They have been very helpful. I have created issues based on our conversation so far.
#927
#926

I want to address them in PRs after this.

@bikallem
Copy link
Contributor Author

bikallem commented Aug 26, 2022

@talex5 It seems I can't reply inline to some comments still.

Yes. I don't see why the comment you linked is a problem for that:

"read_chunked returns an updated set of headers" : just return the unmodified headers in the fixed case
"Each chunk may have chunk extensions" : just return an empty set of extension for fixed bodies

I did experiment with it a bit and came up with a possible read function as below:

val read : 
    ?chunk_handler:(Body.chunk -> unit) ->
    Http.Request.t ->
    Eio.Buf_read.t ->
    [`Header Http.Header.t option | `Content string]

Some considerations on the above API:

  1. For most uses cases of the library you are likely to use read_fixed, therefore it makes little sense to make the user of the library handle the 'chunked' case in every instance. Likely a user would do the following,
match Cohttp_eio.Client.read req buf_read with
| `Content c -> ... (* do something with [s] *)
| `Header _ -> assert false

This makes the lib tedious and feels not optimized for the usage of the most often use case.

  1. In future PRs, I want to add more such specialized reads, such as read_multipart, read_urlencoded to name a few and possibly read_json, read_xml if there is appetite for it. This means the all knowing such read function is going to be less usable and more awkward to use.

The current read API design scales to these requirements and as such it would be preferable to maintain such design property.

@mseri
Copy link
Collaborator

mseri commented Aug 27, 2022

I am still not fully convinced about the read, but I think we can merge and keep iterating on the interface

@mseri
Copy link
Collaborator

mseri commented Aug 27, 2022

I would like to release an alpha version of the new cohttp in few weeks, this hopefully will bring more feedback from possible users on the table and help us further shaoing the api and the functionalities

@mseri mseri merged commit ce5f271 into mirage:master Aug 27, 2022
@bikallem
Copy link
Contributor Author

Thanks.

mseri added a commit to mseri/opam-repository that referenced this pull request Oct 24, 2022
…p-mirage, cohttp-lwt, cohttp-lwt-unix, cohttp-lwt-jsoo, cohttp-eio, cohttp-curl, cohttp-curl-lwt, cohttp-curl-async, cohttp-bench and cohttp-async (6.0.0~alpha0)

CHANGES:

- cohttp-eio: ensure "Host" header is the first header in http client requests (bikallem mirage/ocaml-cohttp#939)
- cohttp-eio: add TE header in client. Check TE header is server (bikallem mirage/ocaml-cohttp#941)
- cohttp-eio: add User-Agent header to request from Client (bikallem mirage/ocaml-cohttp#940)
- cohttp-eio: add Content-Length header to request/response (bikallem mirage/ocaml-cohttp#929)
- cohttp-eio: add cohttp-eio client api - Cohttp_eio.Client (bikallem mirage/ocaml-cohttp#879)
- http: add requires_content_length function for requests and responses (bikallem mirage/ocaml-cohttp#879)
- cohttp-eio: use Eio.Buf_write and improve server API (talex5 mirage/ocaml-cohttp#887)
- cohttp-eio: update to Eio 0.3 (talex5 mirage/ocaml-cohttp#886)
- cohttp-eio: convert to Eio.Buf_read (talex5 mirage/ocaml-cohttp#882)
- cohttp lwt client: Connection cache and explicit pipelining (madroach mirage/ocaml-cohttp#853)
- http: add Http.Request.make and simplify Http.Response.make (bikallem mseri mirage/ocaml-cohttp#878)
- http: add pretty printer functions (bikallem mirage/ocaml-cohttp#880)
- New eio based client and server on top of the http library (bikallem mirage/ocaml-cohttp#857)
- New curl based clients (rgrinberg mirage/ocaml-cohttp#813)
  + cohttp-curl-lwt for an Lwt backend
  + cohttp-curl-async for an Async backend
- Completely new Parsing layers for servers (anuragsoni mirage/ocaml-cohttp#819)
  + Cohttp now uses an optimized parser for requests.
  + The new parser produces much less temporary buffers during read operations
    in servers.
- Faster header comparison (gasche mirage/ocaml-cohttp#818)
- Introduce http package containing common signatures and structures useful for
  compatibility with cohttp - and no dependencies (rgrinberg mirage/ocaml-cohttp#812)
- async(server): allow reading number of active connections (anuragsoni mirage/ocaml-cohttp#809)
- Various internal refactors (rgrinberg, mseri, mirage/ocaml-cohttp#802, mirage/ocaml-cohttp#812, mirage/ocaml-cohttp#820, mirage/ocaml-cohttp#800, mirage/ocaml-cohttp#799,
  mirage/ocaml-cohttp#797)
- http (all cohttp server backends): Consider the connection header in response
  in addition to the request when deciding on whether to keep a connection
  alive (anuragsoni, mirage/ocaml-cohttp#843)
  + The user provided Response can contain a connection header. That header
    will also be considered in addition to the connection header in requests
    when deciding whether to use keep-alive. This allows a handler to decide to
    close a connection even if the client requested a keep-alive in the
    request.
- async(server): allow creating a server without using conduit (anuragsoni mirage/ocaml-cohttp#839)
  + Add `Cohttp_async.Server.Expert.create` and
    `Cohttp_async.Server.Expert.create_with_response_action`that can be used to
    create a server without going through Conduit. This allows creating an
    async TCP server using the Tcp module from `Async_unix` and lets the user
    have more control over how the `Reader.t` and `Writer.t` are created.
- http(header): faster `to_lines` and `to_frames` implementation (mseri mirage/ocaml-cohttp#847)
- cohttp(cookies): use case-insensitive comparison to check for `set-cookies` (mseri mirage/ocaml-cohttp#858)
- New lwt based server implementation: cohttp-server-lwt-unix
  + This new implementation does not depend on conduit and has a simpler and
    more flexible API
- async: Adapt cohttp-curl-async to work with core_unix.
- *Breaking changes*
  + refactor: move opam metadata to dune-project (rgrinberg mirage/ocaml-cohttp#811)
  + refactor: deprecate Cohttp_async.Io (rgrinberg mirage/ocaml-cohttp#807)
  + fix: move more internals to Private (rgrinberg mirage/ocaml-cohttp#806)
  + fix: deprecate transfer encoding field (rgrinberg mirage/ocaml-cohttp#805)
  + refactor: deprecate Cohttp_async.Body_raw (rgrinberg mirage/ocaml-cohttp#804)
  + fix: deprecate more aliases (rgrinberg mirage/ocaml-cohttp#803)
  + refactor: deprecate connection value(rgrinberg mirage/ocaml-cohttp#798)
  + refactor: deprecate using attributes (rgrinberg mirage/ocaml-cohttp#796)
  + cleanup: remove cohttp-{curl,server}-async (rgrinberg mirage/ocaml-cohttp#904)
  + cleanup: remove cohttp-{curl,server,proxy}-lwt (rgrinberg mirage/ocaml-cohttp#904)
  + fix: all parsers now follow the spec and require `\r\n` endings.
    Previously, the `\r` was optional. (rgrinberg, mirage/ocaml-cohttp#921)
- `cohttp-lwt-jsoo`: do not instantiate `XMLHttpRequest` object on boot (mefyl mirage/ocaml-cohttp#922)
mseri added a commit to mseri/opam-repository that referenced this pull request Oct 24, 2022
…p-mirage, cohttp-lwt, cohttp-lwt-unix, cohttp-lwt-jsoo, cohttp-eio, cohttp-curl, cohttp-curl-lwt, cohttp-curl-async, cohttp-bench and cohttp-async (6.0.0~alpha0)

CHANGES:

- cohttp-eio: ensure "Host" header is the first header in http client requests (bikallem mirage/ocaml-cohttp#939)
- cohttp-eio: add TE header in client. Check TE header is server (bikallem mirage/ocaml-cohttp#941)
- cohttp-eio: add User-Agent header to request from Client (bikallem mirage/ocaml-cohttp#940)
- cohttp-eio: add Content-Length header to request/response (bikallem mirage/ocaml-cohttp#929)
- cohttp-eio: add cohttp-eio client api - Cohttp_eio.Client (bikallem mirage/ocaml-cohttp#879)
- http: add requires_content_length function for requests and responses (bikallem mirage/ocaml-cohttp#879)
- cohttp-eio: use Eio.Buf_write and improve server API (talex5 mirage/ocaml-cohttp#887)
- cohttp-eio: update to Eio 0.3 (talex5 mirage/ocaml-cohttp#886)
- cohttp-eio: convert to Eio.Buf_read (talex5 mirage/ocaml-cohttp#882)
- cohttp lwt client: Connection cache and explicit pipelining (madroach mirage/ocaml-cohttp#853)
- http: add Http.Request.make and simplify Http.Response.make (bikallem mseri mirage/ocaml-cohttp#878)
- http: add pretty printer functions (bikallem mirage/ocaml-cohttp#880)
- New eio based client and server on top of the http library (bikallem mirage/ocaml-cohttp#857)
- New curl based clients (rgrinberg mirage/ocaml-cohttp#813)
  + cohttp-curl-lwt for an Lwt backend
  + cohttp-curl-async for an Async backend
- Completely new Parsing layers for servers (anuragsoni mirage/ocaml-cohttp#819)
  + Cohttp now uses an optimized parser for requests.
  + The new parser produces much less temporary buffers during read operations
    in servers.
- Faster header comparison (gasche mirage/ocaml-cohttp#818)
- Introduce http package containing common signatures and structures useful for
  compatibility with cohttp - and no dependencies (rgrinberg mirage/ocaml-cohttp#812)
- async(server): allow reading number of active connections (anuragsoni mirage/ocaml-cohttp#809)
- Various internal refactors (rgrinberg, mseri, mirage/ocaml-cohttp#802, mirage/ocaml-cohttp#812, mirage/ocaml-cohttp#820, mirage/ocaml-cohttp#800, mirage/ocaml-cohttp#799,
  mirage/ocaml-cohttp#797)
- http (all cohttp server backends): Consider the connection header in response
  in addition to the request when deciding on whether to keep a connection
  alive (anuragsoni, mirage/ocaml-cohttp#843)
  + The user provided Response can contain a connection header. That header
    will also be considered in addition to the connection header in requests
    when deciding whether to use keep-alive. This allows a handler to decide to
    close a connection even if the client requested a keep-alive in the
    request.
- async(server): allow creating a server without using conduit (anuragsoni mirage/ocaml-cohttp#839)
  + Add `Cohttp_async.Server.Expert.create` and
    `Cohttp_async.Server.Expert.create_with_response_action`that can be used to
    create a server without going through Conduit. This allows creating an
    async TCP server using the Tcp module from `Async_unix` and lets the user
    have more control over how the `Reader.t` and `Writer.t` are created.
- http(header): faster `to_lines` and `to_frames` implementation (mseri mirage/ocaml-cohttp#847)
- cohttp(cookies): use case-insensitive comparison to check for `set-cookies` (mseri mirage/ocaml-cohttp#858)
- New lwt based server implementation: cohttp-server-lwt-unix
  + This new implementation does not depend on conduit and has a simpler and
    more flexible API
- async: Adapt cohttp-curl-async to work with core_unix.
- *Breaking changes*
  + refactor: move opam metadata to dune-project (rgrinberg mirage/ocaml-cohttp#811)
  + refactor: deprecate Cohttp_async.Io (rgrinberg mirage/ocaml-cohttp#807)
  + fix: move more internals to Private (rgrinberg mirage/ocaml-cohttp#806)
  + fix: deprecate transfer encoding field (rgrinberg mirage/ocaml-cohttp#805)
  + refactor: deprecate Cohttp_async.Body_raw (rgrinberg mirage/ocaml-cohttp#804)
  + fix: deprecate more aliases (rgrinberg mirage/ocaml-cohttp#803)
  + refactor: deprecate connection value(rgrinberg mirage/ocaml-cohttp#798)
  + refactor: deprecate using attributes (rgrinberg mirage/ocaml-cohttp#796)
  + cleanup: remove cohttp-{curl,server}-async (rgrinberg mirage/ocaml-cohttp#904)
  + cleanup: remove cohttp-{curl,server,proxy}-lwt (rgrinberg mirage/ocaml-cohttp#904)
  + fix: all parsers now follow the spec and require `\r\n` endings.
    Previously, the `\r` was optional. (rgrinberg, mirage/ocaml-cohttp#921)
- `cohttp-lwt-jsoo`: do not instantiate `XMLHttpRequest` object on boot (mefyl mirage/ocaml-cohttp#922)
mseri added a commit to mseri/opam-repository that referenced this pull request Oct 24, 2022
…p-mirage, cohttp-lwt, cohttp-lwt-unix, cohttp-lwt-jsoo, cohttp-eio, cohttp-curl, cohttp-curl-lwt, cohttp-curl-async, cohttp-bench and cohttp-async (6.0.0~alpha0)

CHANGES:

- cohttp-eio: ensure "Host" header is the first header in http client requests (bikallem mirage/ocaml-cohttp#939)
- cohttp-eio: add TE header in client. Check TE header is server (bikallem mirage/ocaml-cohttp#941)
- cohttp-eio: add User-Agent header to request from Client (bikallem mirage/ocaml-cohttp#940)
- cohttp-eio: add Content-Length header to request/response (bikallem mirage/ocaml-cohttp#929)
- cohttp-eio: add cohttp-eio client api - Cohttp_eio.Client (bikallem mirage/ocaml-cohttp#879)
- http: add requires_content_length function for requests and responses (bikallem mirage/ocaml-cohttp#879)
- cohttp-eio: use Eio.Buf_write and improve server API (talex5 mirage/ocaml-cohttp#887)
- cohttp-eio: update to Eio 0.3 (talex5 mirage/ocaml-cohttp#886)
- cohttp-eio: convert to Eio.Buf_read (talex5 mirage/ocaml-cohttp#882)
- cohttp lwt client: Connection cache and explicit pipelining (madroach mirage/ocaml-cohttp#853)
- http: add Http.Request.make and simplify Http.Response.make (bikallem mseri mirage/ocaml-cohttp#878)
- http: add pretty printer functions (bikallem mirage/ocaml-cohttp#880)
- New eio based client and server on top of the http library (bikallem mirage/ocaml-cohttp#857)
- New curl based clients (rgrinberg mirage/ocaml-cohttp#813)
  + cohttp-curl-lwt for an Lwt backend
  + cohttp-curl-async for an Async backend
- Completely new Parsing layers for servers (anuragsoni mirage/ocaml-cohttp#819)
  + Cohttp now uses an optimized parser for requests.
  + The new parser produces much less temporary buffers during read operations
    in servers.
- Faster header comparison (gasche mirage/ocaml-cohttp#818)
- Introduce http package containing common signatures and structures useful for
  compatibility with cohttp - and no dependencies (rgrinberg mirage/ocaml-cohttp#812)
- async(server): allow reading number of active connections (anuragsoni mirage/ocaml-cohttp#809)
- Various internal refactors (rgrinberg, mseri, mirage/ocaml-cohttp#802, mirage/ocaml-cohttp#812, mirage/ocaml-cohttp#820, mirage/ocaml-cohttp#800, mirage/ocaml-cohttp#799,
  mirage/ocaml-cohttp#797)
- http (all cohttp server backends): Consider the connection header in response
  in addition to the request when deciding on whether to keep a connection
  alive (anuragsoni, mirage/ocaml-cohttp#843)
  + The user provided Response can contain a connection header. That header
    will also be considered in addition to the connection header in requests
    when deciding whether to use keep-alive. This allows a handler to decide to
    close a connection even if the client requested a keep-alive in the
    request.
- async(server): allow creating a server without using conduit (anuragsoni mirage/ocaml-cohttp#839)
  + Add `Cohttp_async.Server.Expert.create` and
    `Cohttp_async.Server.Expert.create_with_response_action`that can be used to
    create a server without going through Conduit. This allows creating an
    async TCP server using the Tcp module from `Async_unix` and lets the user
    have more control over how the `Reader.t` and `Writer.t` are created.
- http(header): faster `to_lines` and `to_frames` implementation (mseri mirage/ocaml-cohttp#847)
- cohttp(cookies): use case-insensitive comparison to check for `set-cookies` (mseri mirage/ocaml-cohttp#858)
- New lwt based server implementation: cohttp-server-lwt-unix
  + This new implementation does not depend on conduit and has a simpler and
    more flexible API
- async: Adapt cohttp-curl-async to work with core_unix.
- *Breaking changes*
  + refactor: move opam metadata to dune-project (rgrinberg mirage/ocaml-cohttp#811)
  + refactor: deprecate Cohttp_async.Io (rgrinberg mirage/ocaml-cohttp#807)
  + fix: move more internals to Private (rgrinberg mirage/ocaml-cohttp#806)
  + fix: deprecate transfer encoding field (rgrinberg mirage/ocaml-cohttp#805)
  + refactor: deprecate Cohttp_async.Body_raw (rgrinberg mirage/ocaml-cohttp#804)
  + fix: deprecate more aliases (rgrinberg mirage/ocaml-cohttp#803)
  + refactor: deprecate connection value(rgrinberg mirage/ocaml-cohttp#798)
  + refactor: deprecate using attributes (rgrinberg mirage/ocaml-cohttp#796)
  + cleanup: remove cohttp-{curl,server}-async (rgrinberg mirage/ocaml-cohttp#904)
  + cleanup: remove cohttp-{curl,server,proxy}-lwt (rgrinberg mirage/ocaml-cohttp#904)
  + fix: all parsers now follow the spec and require `\r\n` endings.
    Previously, the `\r` was optional. (rgrinberg, mirage/ocaml-cohttp#921)
- `cohttp-lwt-jsoo`: do not instantiate `XMLHttpRequest` object on boot (mefyl mirage/ocaml-cohttp#922)
mseri added a commit to mseri/opam-repository that referenced this pull request Oct 27, 2022
…p-mirage, cohttp-lwt, cohttp-lwt-unix, cohttp-lwt-jsoo, cohttp-eio, cohttp-curl, cohttp-curl-lwt, cohttp-curl-async, cohttp-bench and cohttp-async (6.0.0~alpha0)

CHANGES:

- cohttp-eio: ensure "Host" header is the first header in http client requests (bikallem mirage/ocaml-cohttp#939)
- cohttp-eio: add TE header in client. Check TE header is server (bikallem mirage/ocaml-cohttp#941)
- cohttp-eio: add User-Agent header to request from Client (bikallem mirage/ocaml-cohttp#940)
- cohttp-eio: add Content-Length header to request/response (bikallem mirage/ocaml-cohttp#929)
- cohttp-eio: add cohttp-eio client api - Cohttp_eio.Client (bikallem mirage/ocaml-cohttp#879)
- http: add requires_content_length function for requests and responses (bikallem mirage/ocaml-cohttp#879)
- cohttp-eio: use Eio.Buf_write and improve server API (talex5 mirage/ocaml-cohttp#887)
- cohttp-eio: update to Eio 0.3 (talex5 mirage/ocaml-cohttp#886)
- cohttp-eio: convert to Eio.Buf_read (talex5 mirage/ocaml-cohttp#882)
- cohttp lwt client: Connection cache and explicit pipelining (madroach mirage/ocaml-cohttp#853)
- http: add Http.Request.make and simplify Http.Response.make (bikallem mseri mirage/ocaml-cohttp#878)
- http: add pretty printer functions (bikallem mirage/ocaml-cohttp#880)
- New eio based client and server on top of the http library (bikallem mirage/ocaml-cohttp#857)
- New curl based clients (rgrinberg mirage/ocaml-cohttp#813)
  + cohttp-curl-lwt for an Lwt backend
  + cohttp-curl-async for an Async backend
- Completely new Parsing layers for servers (anuragsoni mirage/ocaml-cohttp#819)
  + Cohttp now uses an optimized parser for requests.
  + The new parser produces much less temporary buffers during read operations
    in servers.
- Faster header comparison (gasche mirage/ocaml-cohttp#818)
- Introduce http package containing common signatures and structures useful for
  compatibility with cohttp - and no dependencies (rgrinberg mirage/ocaml-cohttp#812)
- async(server): allow reading number of active connections (anuragsoni mirage/ocaml-cohttp#809)
- Various internal refactors (rgrinberg, mseri, mirage/ocaml-cohttp#802, mirage/ocaml-cohttp#812, mirage/ocaml-cohttp#820, mirage/ocaml-cohttp#800, mirage/ocaml-cohttp#799,
  mirage/ocaml-cohttp#797)
- http (all cohttp server backends): Consider the connection header in response
  in addition to the request when deciding on whether to keep a connection
  alive (anuragsoni, mirage/ocaml-cohttp#843)
  + The user provided Response can contain a connection header. That header
    will also be considered in addition to the connection header in requests
    when deciding whether to use keep-alive. This allows a handler to decide to
    close a connection even if the client requested a keep-alive in the
    request.
- async(server): allow creating a server without using conduit (anuragsoni mirage/ocaml-cohttp#839)
  + Add `Cohttp_async.Server.Expert.create` and
    `Cohttp_async.Server.Expert.create_with_response_action`that can be used to
    create a server without going through Conduit. This allows creating an
    async TCP server using the Tcp module from `Async_unix` and lets the user
    have more control over how the `Reader.t` and `Writer.t` are created.
- http(header): faster `to_lines` and `to_frames` implementation (mseri mirage/ocaml-cohttp#847)
- cohttp(cookies): use case-insensitive comparison to check for `set-cookies` (mseri mirage/ocaml-cohttp#858)
- New lwt based server implementation: cohttp-server-lwt-unix
  + This new implementation does not depend on conduit and has a simpler and
    more flexible API
- async: Adapt cohttp-curl-async to work with core_unix.
- *Breaking changes*
  + refactor: move opam metadata to dune-project (rgrinberg mirage/ocaml-cohttp#811)
  + refactor: deprecate Cohttp_async.Io (rgrinberg mirage/ocaml-cohttp#807)
  + fix: move more internals to Private (rgrinberg mirage/ocaml-cohttp#806)
  + fix: deprecate transfer encoding field (rgrinberg mirage/ocaml-cohttp#805)
  + refactor: deprecate Cohttp_async.Body_raw (rgrinberg mirage/ocaml-cohttp#804)
  + fix: deprecate more aliases (rgrinberg mirage/ocaml-cohttp#803)
  + refactor: deprecate connection value(rgrinberg mirage/ocaml-cohttp#798)
  + refactor: deprecate using attributes (rgrinberg mirage/ocaml-cohttp#796)
  + cleanup: remove cohttp-{curl,server}-async (rgrinberg mirage/ocaml-cohttp#904)
  + cleanup: remove cohttp-{curl,server,proxy}-lwt (rgrinberg mirage/ocaml-cohttp#904)
  + fix: all parsers now follow the spec and require `\r\n` endings.
    Previously, the `\r` was optional. (rgrinberg, mirage/ocaml-cohttp#921)
- `cohttp-lwt-jsoo`: do not instantiate `XMLHttpRequest` object on boot (mefyl mirage/ocaml-cohttp#922)
mseri added a commit to mseri/opam-repository that referenced this pull request Oct 27, 2022
…p-mirage, cohttp-lwt, cohttp-lwt-unix, cohttp-lwt-jsoo, cohttp-eio, cohttp-curl, cohttp-curl-lwt, cohttp-curl-async, cohttp-bench and cohttp-async (6.0.0~alpha0)

CHANGES:

- cohttp-eio: ensure "Host" header is the first header in http client requests (bikallem mirage/ocaml-cohttp#939)
- cohttp-eio: add TE header in client. Check TE header is server (bikallem mirage/ocaml-cohttp#941)
- cohttp-eio: add User-Agent header to request from Client (bikallem mirage/ocaml-cohttp#940)
- cohttp-eio: add Content-Length header to request/response (bikallem mirage/ocaml-cohttp#929)
- cohttp-eio: add cohttp-eio client api - Cohttp_eio.Client (bikallem mirage/ocaml-cohttp#879)
- http: add requires_content_length function for requests and responses (bikallem mirage/ocaml-cohttp#879)
- cohttp-eio: use Eio.Buf_write and improve server API (talex5 mirage/ocaml-cohttp#887)
- cohttp-eio: update to Eio 0.3 (talex5 mirage/ocaml-cohttp#886)
- cohttp-eio: convert to Eio.Buf_read (talex5 mirage/ocaml-cohttp#882)
- cohttp lwt client: Connection cache and explicit pipelining (madroach mirage/ocaml-cohttp#853)
- http: add Http.Request.make and simplify Http.Response.make (bikallem mseri mirage/ocaml-cohttp#878)
- http: add pretty printer functions (bikallem mirage/ocaml-cohttp#880)
- New eio based client and server on top of the http library (bikallem mirage/ocaml-cohttp#857)
- New curl based clients (rgrinberg mirage/ocaml-cohttp#813)
  + cohttp-curl-lwt for an Lwt backend
  + cohttp-curl-async for an Async backend
- Completely new Parsing layers for servers (anuragsoni mirage/ocaml-cohttp#819)
  + Cohttp now uses an optimized parser for requests.
  + The new parser produces much less temporary buffers during read operations
    in servers.
- Faster header comparison (gasche mirage/ocaml-cohttp#818)
- Introduce http package containing common signatures and structures useful for
  compatibility with cohttp - and no dependencies (rgrinberg mirage/ocaml-cohttp#812)
- async(server): allow reading number of active connections (anuragsoni mirage/ocaml-cohttp#809)
- Various internal refactors (rgrinberg, mseri, mirage/ocaml-cohttp#802, mirage/ocaml-cohttp#812, mirage/ocaml-cohttp#820, mirage/ocaml-cohttp#800, mirage/ocaml-cohttp#799,
  mirage/ocaml-cohttp#797)
- http (all cohttp server backends): Consider the connection header in response
  in addition to the request when deciding on whether to keep a connection
  alive (anuragsoni, mirage/ocaml-cohttp#843)
  + The user provided Response can contain a connection header. That header
    will also be considered in addition to the connection header in requests
    when deciding whether to use keep-alive. This allows a handler to decide to
    close a connection even if the client requested a keep-alive in the
    request.
- async(server): allow creating a server without using conduit (anuragsoni mirage/ocaml-cohttp#839)
  + Add `Cohttp_async.Server.Expert.create` and
    `Cohttp_async.Server.Expert.create_with_response_action`that can be used to
    create a server without going through Conduit. This allows creating an
    async TCP server using the Tcp module from `Async_unix` and lets the user
    have more control over how the `Reader.t` and `Writer.t` are created.
- http(header): faster `to_lines` and `to_frames` implementation (mseri mirage/ocaml-cohttp#847)
- cohttp(cookies): use case-insensitive comparison to check for `set-cookies` (mseri mirage/ocaml-cohttp#858)
- New lwt based server implementation: cohttp-server-lwt-unix
  + This new implementation does not depend on conduit and has a simpler and
    more flexible API
- async: Adapt cohttp-curl-async to work with core_unix.
- *Breaking changes*
  + refactor: move opam metadata to dune-project (rgrinberg mirage/ocaml-cohttp#811)
  + refactor: deprecate Cohttp_async.Io (rgrinberg mirage/ocaml-cohttp#807)
  + fix: move more internals to Private (rgrinberg mirage/ocaml-cohttp#806)
  + fix: deprecate transfer encoding field (rgrinberg mirage/ocaml-cohttp#805)
  + refactor: deprecate Cohttp_async.Body_raw (rgrinberg mirage/ocaml-cohttp#804)
  + fix: deprecate more aliases (rgrinberg mirage/ocaml-cohttp#803)
  + refactor: deprecate connection value(rgrinberg mirage/ocaml-cohttp#798)
  + refactor: deprecate using attributes (rgrinberg mirage/ocaml-cohttp#796)
  + cleanup: remove cohttp-{curl,server}-async (rgrinberg mirage/ocaml-cohttp#904)
  + cleanup: remove cohttp-{curl,server,proxy}-lwt (rgrinberg mirage/ocaml-cohttp#904)
  + fix: all parsers now follow the spec and require `\r\n` endings.
    Previously, the `\r` was optional. (rgrinberg, mirage/ocaml-cohttp#921)
- `cohttp-lwt-jsoo`: do not instantiate `XMLHttpRequest` object on boot (mefyl mirage/ocaml-cohttp#922)
mseri added a commit to mseri/opam-repository that referenced this pull request Oct 27, 2022
…p-mirage, cohttp-lwt, cohttp-lwt-unix, cohttp-lwt-jsoo, cohttp-eio, cohttp-curl, cohttp-curl-lwt, cohttp-curl-async, cohttp-bench and cohttp-async (6.0.0~alpha0)

CHANGES:

- cohttp-eio: ensure "Host" header is the first header in http client requests (bikallem mirage/ocaml-cohttp#939)
- cohttp-eio: add TE header in client. Check TE header is server (bikallem mirage/ocaml-cohttp#941)
- cohttp-eio: add User-Agent header to request from Client (bikallem mirage/ocaml-cohttp#940)
- cohttp-eio: add Content-Length header to request/response (bikallem mirage/ocaml-cohttp#929)
- cohttp-eio: add cohttp-eio client api - Cohttp_eio.Client (bikallem mirage/ocaml-cohttp#879)
- http: add requires_content_length function for requests and responses (bikallem mirage/ocaml-cohttp#879)
- cohttp-eio: use Eio.Buf_write and improve server API (talex5 mirage/ocaml-cohttp#887)
- cohttp-eio: update to Eio 0.3 (talex5 mirage/ocaml-cohttp#886)
- cohttp-eio: convert to Eio.Buf_read (talex5 mirage/ocaml-cohttp#882)
- cohttp lwt client: Connection cache and explicit pipelining (madroach mirage/ocaml-cohttp#853)
- http: add Http.Request.make and simplify Http.Response.make (bikallem mseri mirage/ocaml-cohttp#878)
- http: add pretty printer functions (bikallem mirage/ocaml-cohttp#880)
- New eio based client and server on top of the http library (bikallem mirage/ocaml-cohttp#857)
- New curl based clients (rgrinberg mirage/ocaml-cohttp#813)
  + cohttp-curl-lwt for an Lwt backend
  + cohttp-curl-async for an Async backend
- Completely new Parsing layers for servers (anuragsoni mirage/ocaml-cohttp#819)
  + Cohttp now uses an optimized parser for requests.
  + The new parser produces much less temporary buffers during read operations
    in servers.
- Faster header comparison (gasche mirage/ocaml-cohttp#818)
- Introduce http package containing common signatures and structures useful for
  compatibility with cohttp - and no dependencies (rgrinberg mirage/ocaml-cohttp#812)
- async(server): allow reading number of active connections (anuragsoni mirage/ocaml-cohttp#809)
- Various internal refactors (rgrinberg, mseri, mirage/ocaml-cohttp#802, mirage/ocaml-cohttp#812, mirage/ocaml-cohttp#820, mirage/ocaml-cohttp#800, mirage/ocaml-cohttp#799,
  mirage/ocaml-cohttp#797)
- http (all cohttp server backends): Consider the connection header in response
  in addition to the request when deciding on whether to keep a connection
  alive (anuragsoni, mirage/ocaml-cohttp#843)
  + The user provided Response can contain a connection header. That header
    will also be considered in addition to the connection header in requests
    when deciding whether to use keep-alive. This allows a handler to decide to
    close a connection even if the client requested a keep-alive in the
    request.
- async(server): allow creating a server without using conduit (anuragsoni mirage/ocaml-cohttp#839)
  + Add `Cohttp_async.Server.Expert.create` and
    `Cohttp_async.Server.Expert.create_with_response_action`that can be used to
    create a server without going through Conduit. This allows creating an
    async TCP server using the Tcp module from `Async_unix` and lets the user
    have more control over how the `Reader.t` and `Writer.t` are created.
- http(header): faster `to_lines` and `to_frames` implementation (mseri mirage/ocaml-cohttp#847)
- cohttp(cookies): use case-insensitive comparison to check for `set-cookies` (mseri mirage/ocaml-cohttp#858)
- New lwt based server implementation: cohttp-server-lwt-unix
  + This new implementation does not depend on conduit and has a simpler and
    more flexible API
- async: Adapt cohttp-curl-async to work with core_unix.
- *Breaking changes*
  + refactor: move opam metadata to dune-project (rgrinberg mirage/ocaml-cohttp#811)
  + refactor: deprecate Cohttp_async.Io (rgrinberg mirage/ocaml-cohttp#807)
  + fix: move more internals to Private (rgrinberg mirage/ocaml-cohttp#806)
  + fix: deprecate transfer encoding field (rgrinberg mirage/ocaml-cohttp#805)
  + refactor: deprecate Cohttp_async.Body_raw (rgrinberg mirage/ocaml-cohttp#804)
  + fix: deprecate more aliases (rgrinberg mirage/ocaml-cohttp#803)
  + refactor: deprecate connection value(rgrinberg mirage/ocaml-cohttp#798)
  + refactor: deprecate using attributes (rgrinberg mirage/ocaml-cohttp#796)
  + cleanup: remove cohttp-{curl,server}-async (rgrinberg mirage/ocaml-cohttp#904)
  + cleanup: remove cohttp-{curl,server,proxy}-lwt (rgrinberg mirage/ocaml-cohttp#904)
  + fix: all parsers now follow the spec and require `\r\n` endings.
    Previously, the `\r` was optional. (rgrinberg, mirage/ocaml-cohttp#921)
- `cohttp-lwt-jsoo`: do not instantiate `XMLHttpRequest` object on boot (mefyl mirage/ocaml-cohttp#922)
@bikallem bikallem deleted the eio-client branch November 9, 2022 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants