prepare for 0.17

This commit is contained in:
Simon Cruanes 2024-06-20 15:23:42 -04:00
parent 0b4c28264c
commit 9eb3cbfc70
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
9 changed files with 43 additions and 17 deletions

View file

@ -1,6 +1,32 @@
## Pending
## 0.17
- add optional middlewares to tiny_httpd_ws
- add `Head_middleware.trivial`
- add `Head_middleware.t`; accept it for SSE/websocket
- add `Request.pp_with` which is a customizable printer
- expose `Response.Bad_req`
- use `iostream` for IOs
- add a `hmap`-typed field to requests, to carry request specific data
across middlewares
- http_of_dir: ability to setup socket timeout
- add `tiny_httpd.ws`, a websocket library
- add `Response_code.is_success`
- fix: No setting of sigprocmask on Windows
- fix: give the correct code+error if protocol upgrade fails
- remove potentially security-leaking debug line
- fix: avoid collisions in `Mime_` private module
- fix middlewares: merge-sort per-request middleares and global ones
- fix tiny_httpd dir: handle html files
- perf: optim in read_line
- perf: remove some uses of scanf in parsing
- require iostream-camlzip >= 0.2.1
- add optional dependency on `logs`
- logs is a testdep for tiny_httpd_camlzip
## 0.16

View file

@ -4,7 +4,7 @@
(authors c-cube)
(maintainers c-cube)
(version 0.16)
(version 0.17)
(source (github c-cube/tiny_httpd))
(homepage https://github.com/c-cube/tiny_httpd/)
(license MIT)

View file

@ -11,7 +11,7 @@ type 'body t = private {
(** Host header, mandatory. It can also be found in {!headers}. *)
client_addr: Unix.sockaddr; (** Client address. Available since 0.14. *)
headers: Headers.t; (** List of headers. *)
mutable meta: Hmap.t; (** Metadata. @since NEXT_RELEASE *)
mutable meta: Hmap.t; (** Metadata. @since 0.17 *)
http_version: int * int;
(** HTTP version. This should be either [1, 0] or [1, 1]. *)
path: string; (** Full path of the requested URL. *)
@ -38,16 +38,16 @@ type 'body t = private {
val add_meta : _ t -> 'a Hmap.key -> 'a -> unit
(** Add metadata
@since NEXT_RELEASE *)
@since 0.17 *)
val get_meta : _ t -> 'a Hmap.key -> 'a option
(** Get metadata
@since NEXT_RELEASE *)
@since 0.17 *)
val get_meta_exn : _ t -> 'a Hmap.key -> 'a
(** Like {!get_meta} but can fail
@raise Invalid_argument if not present
@since NEXT_RELEASE *)
@since 0.17 *)
val pp_with :
?mask_header:(string -> bool) ->
@ -94,7 +94,7 @@ val set_header : string -> string -> 'a t -> 'a t
val remove_header : string -> 'a t -> 'a t
(** Remove one instance of this header.
@since NEXT_RELEASE *)
@since 0.17 *)
val update_headers : (Headers.t -> Headers.t) -> 'a t -> 'a t
(** Modify headers using the given function.

View file

@ -38,7 +38,7 @@ val update_headers : (Headers.t -> Headers.t) -> t -> t
val remove_header : string -> t -> t
(** Remove one instance of this header.
@since NEXT_RELEASE *)
@since 0.17 *)
val set_headers : Headers.t -> t -> t
(** Set all headers.

View file

@ -17,4 +17,4 @@ val descr : t -> string
val is_success : t -> bool
(** [is_success code] is true iff [code] is in the [2xx] or [3xx] range.
@since NEXT_RELEASE *)
@since 0.17 *)

View file

@ -41,12 +41,12 @@ end
These middlewares are simpler than full {!Middleware.t} and
work in more contexts.
@since NEXT_RELEASE *)
@since 0.17 *)
module Head_middleware : sig
type t = { handle: 'a. 'a Request.t -> 'a Request.t }
(** A handler that takes the request, without its body,
and possibly modifies it.
@since NEXT_RELEASE *)
@since 0.17 *)
val trivial : t
(** Pass through *)
@ -260,10 +260,10 @@ val add_route_server_sent_handler :
(** {2 Upgrade handlers}
These handlers upgrade the connection to another protocol.
@since NEXT_RELEASE *)
@since 0.17 *)
(** Handler that upgrades to another protocol.
@since NEXT_RELEASE *)
@since 0.17 *)
module type UPGRADE_HANDLER = sig
type handshake_state
(** Some specific state returned after handshake *)
@ -287,7 +287,7 @@ module type UPGRADE_HANDLER = sig
end
type upgrade_handler = (module UPGRADE_HANDLER)
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val add_upgrade_handler :
?accept:(unit Request.t -> (unit, Response_code.t * string) result) ->

View file

@ -37,8 +37,8 @@ val parse_query : string -> ((string * string) list, string) result
val show_sockaddr : Unix.sockaddr -> string
(** Simple printer for socket addresses.
@since NEXT_RELEASE *)
@since 0.17 *)
val is_ipv6_str : string -> bool
(** Is this string potentially an IPV6 address?
@since NEXT_RELEASE *)
@since 0.17 *)

View file

@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.16"
version: "0.17"
synopsis: "Minimal HTTP server using threads"
maintainer: ["c-cube"]
authors: ["c-cube"]

View file

@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.16"
version: "0.17"
synopsis: "Interface to camlzip for tiny_httpd"
maintainer: ["c-cube"]
authors: ["c-cube"]