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

bench(http): optimize to_frames and to_lines functions #847

Merged
merged 3 commits into from
Jan 18, 2022

Conversation

mseri
Copy link
Collaborator

@mseri mseri commented Jan 17, 2022

The benchmark for to_frame resulted in a slightly better performance for string concatenation, in line with https://discuss.ocaml.org/t/whats-the-fastest-way-to-concatenate-strings/2616/12

Estimated testing time 30s (3 benchmarks x 10s). Change using '-quota'.
┌─────────┬──────────┬───────────┬─────────┬──────────┬──────────┬────────────┐
│ Name    │ Time/Run │ Cycls/Run │ mWd/Run │ mjWd/Run │ Prom/Run │ Percentage │
├─────────┼──────────┼───────────┼─────────┼──────────┼──────────┼────────────┤
│ Sprintf │ 902.10ns │    2.34kc │ 660.00w │    0.13w │    0.13w │    100.00% │
│ Buffer  │ 480.78ns │    1.25kc │ 116.00w │          │          │     53.29% │
│ Concat  │ 429.12ns │    1.11kc │ 166.00w │          │          │     47.57% │
└─────────┴──────────┴───────────┴─────────┴──────────┴──────────┴────────────┘

The to_lines function gave the following result, also much better using a buffer.

Estimated testing time 20s (2 benchmarks x 10s). Change using '-quota'.
┌─────────┬────────────┬───────────┬─────────┬──────────┬──────────┬────────────┐
│ Name    │   Time/Run │ Cycls/Run │ mWd/Run │ mjWd/Run │ Prom/Run │ Percentage │
├─────────┼────────────┼───────────┼─────────┼──────────┼──────────┼────────────┤
│ Sprintf │ 1_015.62ns │    2.63kc │ 702.00w │    0.13w │    0.13w │    100.00% │
│ Buffer  │   579.60ns │    1.50kc │ 119.00w │          │          │     57.07% │
└─────────┴────────────┴───────────┴─────────┴──────────┴──────────┴────────────┘

The patch to reproduce the first benchmark is:

From 4d8c894f1de73558966bf64ccaaf6c90013f5bf7 Mon Sep 17 00:00:00 2001
From: Marcello Seri <marcello.seri@gmail.com>
Date: Mon, 17 Jan 2022 22:23:05 +0100
Subject: [PATCH] temp

Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
---
 bench/bench.ml    | 18 +++++++++++++++++-
 http/src/http.ml  | 15 +++++++++++++++
 http/src/http.mli |  4 ++++
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/bench/bench.ml b/bench/bench.ml
index 57deedda..2aee104b 100644
--- a/bench/bench.ml
+++ b/bench/bench.ml
@@ -26,4 +26,20 @@ let bench_header_mem =
   Bench.Test.create ~name:"Header.mem" (fun () ->
       List.iter (fun key -> assert (Http.Header.mem header key)) header_names)
 
-let () = Command.run @@ Bench.make_command [ bench_header_mem ]
+let bench_header_to_frames_sprintf =
+  Bench.Test.create ~name:"Sprintf" (fun () -> Http.Header.to_frames header |> ignore)
+
+let bench_header_to_frames_buffer =
+  Bench.Test.create ~name:"Buffer" (fun () -> Http.Header.to_frames_buffer header |> ignore)
+
+let bench_header_to_frames_concat =
+  Bench.Test.create ~name:"Concat" (fun () -> Http.Header.to_frames_concat header |> ignore)
+
+let () =
+  Command.run @@ Bench.make_command [ bench_header_mem ];
+  Command.run @@ Bench.make_command [
+    bench_header_to_frames_sprintf;
+    bench_header_to_frames_buffer;
+    bench_header_to_frames_concat
+  ]
+
diff --git a/http/src/http.ml b/http/src/http.ml
index eab18dce..65251bdb 100644
--- a/http/src/http.ml
+++ b/http/src/http.ml
@@ -175,6 +175,21 @@ module Header = struct
     let to_frame k v = Printf.sprintf "%s: %s" k v in
     List.fold_left (fun acc (k, v) -> to_frame k v :: acc) [] h
 
+  let to_frames_concat h =
+    let to_frame k v = String.concat ": " [ k; v ] in
+    List.fold_left (fun acc (k, v) -> to_frame k v :: acc) [] h
+
+  let to_frames_buffer h =
+    let b = Buffer.create 128 in
+    let to_frame k v =
+      Buffer.clear b;
+      Buffer.add_string b k;
+      Buffer.add_string b ": ";
+      Buffer.add_string b v;
+      Buffer.contents b
+    in
+    List.fold_left (fun acc (k, v) -> to_frame k v :: acc) [] h
+
   let to_string h =
     let b = Buffer.create 128 in
     to_list h
diff --git a/http/src/http.mli b/http/src/http.mli
index d5297d53..09d914a0 100644
--- a/http/src/http.mli
+++ b/http/src/http.mli
@@ -308,6 +308,10 @@ module Header : sig
   (** [to_frames h] returns the same as {!to_lines} but lines do not end with
       "\r\n" characters. *)
 
+
+  val to_frames_concat : t -> string list
+  val to_frames_buffer : t -> string list
+
   val to_string : t -> string
 
   val clean_dup : t -> t
-- 
2.32.0 (Apple Git-132)

While the second is

From 07537b48b7aaa79555997047d92cd962df7d3494 Mon Sep 17 00:00:00 2001
From: Marcello Seri <marcello.seri@gmail.com>
Date: Mon, 17 Jan 2022 22:23:05 +0100
Subject: [PATCH] temp

Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
---
 bench/bench.ml    | 14 +++++++++++++-
 http/src/http.ml  | 16 ++++++++++++++--
 http/src/http.mli |  2 ++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/bench/bench.ml b/bench/bench.ml
index 57deedda..0ea1e511 100644
--- a/bench/bench.ml
+++ b/bench/bench.ml
@@ -26,4 +26,16 @@ let bench_header_mem =
   Bench.Test.create ~name:"Header.mem" (fun () ->
       List.iter (fun key -> assert (Http.Header.mem header key)) header_names)
 
-let () = Command.run @@ Bench.make_command [ bench_header_mem ]
+let bench_header_to_lines_sprintf =
+  Bench.Test.create ~name:"Sprintf" (fun () -> Http.Header.to_lines header |> ignore)
+
+let bench_header_to_lines_buffer =
+  Bench.Test.create ~name:"Buffer" (fun () -> Http.Header.to_lines_buffer header |> ignore)
+
+let () =
+  Command.run @@ Bench.make_command [ bench_header_mem ];
+  Command.run @@ Bench.make_command [
+    bench_header_to_lines_sprintf;
+    bench_header_to_lines_buffer;
+  ]
+
diff --git a/http/src/http.ml b/http/src/http.ml
index eab18dce..fa830c15 100644
--- a/http/src/http.ml
+++ b/http/src/http.ml
@@ -167,12 +167,24 @@ module Header = struct
   let of_list h = List.rev h
   let to_list h = List.rev h
 
-  let to_lines (h : t) =
+let to_lines (h : t) =
     let header_line k v = Printf.sprintf "%s: %s\r\n" k v in
     List.fold_left (fun acc (k, v) -> header_line k v :: acc) [] h
 
+  let to_lines_buffer (h : t) =
+     let b = Buffer.create 128 in
+   let header_line k v =
+     Buffer.clear b;
+     Buffer.add_string b k;
+     Buffer.add_string b ": ";
+     Buffer.add_string b v;
+     Buffer.add_string b "\r\n";
+     Buffer.contents b
+   in
+    List.fold_left (fun acc (k, v) -> header_line k v :: acc) [] h
+
   let to_frames h =
-    let to_frame k v = Printf.sprintf "%s: %s" k v in
+    let to_frame k v = String.concat ": " [ k; v ] in
     List.fold_left (fun acc (k, v) -> to_frame k v :: acc) [] h
 
   let to_string h =
diff --git a/http/src/http.mli b/http/src/http.mli
index d5297d53..44de52a9 100644
--- a/http/src/http.mli
+++ b/http/src/http.mli
@@ -304,6 +304,8 @@ module Header : sig
   (** [to_lines h] returns header fieds as a list of lines. Beware that each
       line ends with "\r\n" characters. *)
 
+  val to_lines_buffer : t -> string list
+
   val to_frames : t -> string list
   (** [to_frames h] returns the same as {!to_lines} but lines do not end with
       "\r\n" characters. *)
-- 
2.32.0 (Apple Git-132)

It felt a bit pointless to leave the benchmarks in, but I am happy to add them back if you think it is worth it

Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
Signed-off-by: Marcello Seri <marcello.seri@gmail.com>
@mseri mseri merged commit eda51c1 into mirage:master Jan 18, 2022
@mseri mseri deleted the header branch January 18, 2022 12:33
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)
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.

2 participants