Skip to content

Commit

Permalink
prepare for 0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Jun 20, 2024
1 parent 0b4c282 commit 9eb3cbf
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 17 deletions.
26 changes: 26 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/core/request.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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. *)
Expand All @@ -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) ->
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/core/response.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/core/response_code.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
10 changes: 5 additions & 5 deletions src/core/server.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
Expand Down Expand Up @@ -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 *)
Expand All @@ -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) ->
Expand Down
4 changes: 2 additions & 2 deletions src/core/util.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
2 changes: 1 addition & 1 deletion tiny_httpd.opam
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion tiny_httpd_camlzip.opam
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down

0 comments on commit 9eb3cbf

Please sign in to comment.