This commit is contained in:
Simon Cruanes 2024-02-26 15:59:23 -05:00
parent adf4c6815f
commit e3047a7b6a
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
4 changed files with 9 additions and 6 deletions

View file

@ -77,18 +77,18 @@ module Output = struct
) )
in in
object (self) object
method flush () = method flush () =
write_buf ~force:true (); write_buf ~force:true ();
flush self flush oc
method close () = method close () =
write_buf ~force:true (); write_buf ~force:true ();
(* write an empty chunk to close the stream *) (* 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) *) (* write another crlf after the stream (see #56) *)
output_string self "\r\n"; output_string oc "\r\n";
self#flush (); flush oc;
if close_rec then close oc if close_rec then close oc
method output b i n = method output b i n =

View file

@ -18,7 +18,8 @@ let to_output ?(top = false) (self : elt) (out : #IO.Output.t) : unit =
let out = Out.create_of_out out in let out = Out.create_of_out out in
if top then Out.add_string out "<!DOCTYPE html>\n"; if top then Out.add_string out "<!DOCTYPE html>\n";
self out; self out;
Out.add_format_nl out Out.add_format_nl out;
Out.flush out
(** Convert a HTML element to a string. (** Convert a HTML element to a string.
@param top if true, add DOCTYPE at the beginning. The top element should then @param top if true, add DOCTYPE at the beginning. The top element should then

View file

@ -16,6 +16,7 @@ depends: [
"base-threads" "base-threads"
"result" "result"
"hmap" "hmap"
"iostream" {>= "0.2"}
"ocaml" {>= "4.08"} "ocaml" {>= "4.08"}
"odoc" {with-doc} "odoc" {with-doc}
"logs" {with-test} "logs" {with-test}

View file

@ -11,6 +11,7 @@ depends: [
"dune" {>= "2.9"} "dune" {>= "2.9"}
"tiny_httpd" {= version} "tiny_httpd" {= version}
"camlzip" {>= "1.06"} "camlzip" {>= "1.06"}
"iostream-camlzip"
"logs" {with-test} "logs" {with-test}
"odoc" {with-doc} "odoc" {with-doc}
] ]