From e3047a7b6a8b2e9c8aa3151644e33dbdbdfb64e7 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 26 Feb 2024 15:59:23 -0500 Subject: [PATCH] fixes --- src/core/IO.ml | 10 +++++----- src/html/Tiny_httpd_html.ml | 3 ++- tiny_httpd.opam | 1 + tiny_httpd_camlzip.opam | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/IO.ml b/src/core/IO.ml index afcdc8df..03ff5919 100644 --- a/src/core/IO.ml +++ b/src/core/IO.ml @@ -77,18 +77,18 @@ module Output = struct ) in - object (self) + object method flush () = write_buf ~force:true (); - flush self + flush oc method close () = write_buf ~force:true (); (* write an empty chunk to close the stream *) - output_string self "0\r\n"; + output_string oc "0\r\n"; (* write another crlf after the stream (see #56) *) - output_string self "\r\n"; - self#flush (); + output_string oc "\r\n"; + flush oc; if close_rec then close oc method output b i n = diff --git a/src/html/Tiny_httpd_html.ml b/src/html/Tiny_httpd_html.ml index 0b1ac3f9..af9cf45d 100644 --- a/src/html/Tiny_httpd_html.ml +++ b/src/html/Tiny_httpd_html.ml @@ -18,7 +18,8 @@ let to_output ?(top = false) (self : elt) (out : #IO.Output.t) : unit = let out = Out.create_of_out out in if top then Out.add_string out "\n"; self out; - Out.add_format_nl out + Out.add_format_nl out; + Out.flush out (** Convert a HTML element to a string. @param top if true, add DOCTYPE at the beginning. The top element should then diff --git a/tiny_httpd.opam b/tiny_httpd.opam index ffd43a56..c144b511 100644 --- a/tiny_httpd.opam +++ b/tiny_httpd.opam @@ -16,6 +16,7 @@ depends: [ "base-threads" "result" "hmap" + "iostream" {>= "0.2"} "ocaml" {>= "4.08"} "odoc" {with-doc} "logs" {with-test} diff --git a/tiny_httpd_camlzip.opam b/tiny_httpd_camlzip.opam index e8a269f2..e28dde38 100644 --- a/tiny_httpd_camlzip.opam +++ b/tiny_httpd_camlzip.opam @@ -11,6 +11,7 @@ depends: [ "dune" {>= "2.9"} "tiny_httpd" {= version} "camlzip" {>= "1.06"} + "iostream-camlzip" "logs" {with-test} "odoc" {with-doc} ]