From 04fb64857611e9fbfee18ab123407960b6164ffc Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 24 May 2023 15:17:04 -0400 Subject: [PATCH] update docs --- src/Tiny_httpd.ml | 8 -------- src/Tiny_httpd.mli | 9 +++------ src/Tiny_httpd_stream.mli | 3 +++ src/camlzip/Tiny_httpd_camlzip.mli | 12 ++++++++++++ 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/Tiny_httpd.ml b/src/Tiny_httpd.ml index 784f7de7..87e7890b 100644 --- a/src/Tiny_httpd.ml +++ b/src/Tiny_httpd.ml @@ -1,11 +1,3 @@ -(** Tiny Httpd. - - A small HTTP/1.1 server, in pure OCaml, along with some utilities - to build small websites. The primary use case is to build UIs for tools - that are {b not} primarily websites, but can benefit from an embedded - web server. -*) - module Buf = Tiny_httpd_buf module Byte_stream = Tiny_httpd_stream include Tiny_httpd_server diff --git a/src/Tiny_httpd.mli b/src/Tiny_httpd.mli index c38e4665..e7385567 100644 --- a/src/Tiny_httpd.mli +++ b/src/Tiny_httpd.mli @@ -1,4 +1,4 @@ -(** {1 Tiny Http Server} +(** Tiny Http Server This library implements a very simple, basic HTTP/1.1 server using blocking IOs and threads. Basic routing based on {!Scanf} is provided for convenience, @@ -81,10 +81,7 @@ echo: module Buf = Tiny_httpd_buf -(** {2 Generic stream of data} - - Streams are used to represent a series of bytes that can arrive progressively. - For example, an uploaded file will be sent as a series of chunks. *) +(** {2 Generic byte streams} *) module Byte_stream = Tiny_httpd_stream @@ -105,4 +102,4 @@ module Dir = Tiny_httpd_dir module Html = Tiny_httpd_html (** Alias to {!Tiny_httpd_html} - @since NEXT_RELEASE *) + @since 0.12 *) diff --git a/src/Tiny_httpd_stream.mli b/src/Tiny_httpd_stream.mli index 5256d808..b2966662 100644 --- a/src/Tiny_httpd_stream.mli +++ b/src/Tiny_httpd_stream.mli @@ -1,5 +1,8 @@ (** Byte streams. + Streams are used to represent a series of bytes that can arrive progressively. + For example, an uploaded file will be sent as a series of chunks. + These used to live in {!Tiny_httpd} but are now in their own module. @since 0.12 *) diff --git a/src/camlzip/Tiny_httpd_camlzip.mli b/src/camlzip/Tiny_httpd_camlzip.mli index e61e1806..2fb7f570 100644 --- a/src/camlzip/Tiny_httpd_camlzip.mli +++ b/src/camlzip/Tiny_httpd_camlzip.mli @@ -1,6 +1,18 @@ +(** Middleware for compression. + + This uses camlzip to provide deflate compression/decompression. + If installed, the middleware will compress responses' bodies + when they are streams or fixed-size above a given limit + (but it will not compress small, fixed-size bodies). + *) + val middleware : ?compress_above:int -> ?buf_size:int -> unit -> Tiny_httpd_server.Middleware.t (** Middleware responsible for deflate compression/decompression. + @param compress_above threshold, in bytes, above which a response body + that has a known content-length is compressed. Stream bodies + are always compressed. + @param buf_size size of the underlying buffer for compression/decompression @since 0.11 *) val setup : ?compress_above:int -> ?buf_size:int -> Tiny_httpd_server.t -> unit