mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
prepare for 0.11
This commit is contained in:
parent
4aaa61f622
commit
3a7019c7cb
6 changed files with 22 additions and 14 deletions
|
|
@ -230,7 +230,7 @@ module Request : sig
|
||||||
body: 'body;
|
body: 'body;
|
||||||
start_time: float;
|
start_time: float;
|
||||||
(** Obtained via [get_time_s] in {!create}
|
(** Obtained via [get_time_s] in {!create}
|
||||||
@since NEXT_RELEASE *)
|
@since 0.11 *)
|
||||||
}
|
}
|
||||||
(** A request with method, path, host, headers, and a body, sent by a client.
|
(** A request with method, path, host, headers, and a body, sent by a client.
|
||||||
|
|
||||||
|
|
@ -241,8 +241,8 @@ module Request : sig
|
||||||
|
|
||||||
@since 0.6 The field [query] was added and contains the query parameters in ["?foo=bar,x=y"]
|
@since 0.6 The field [query] was added and contains the query parameters in ["?foo=bar,x=y"]
|
||||||
@since 0.6 The field [path_components] is the part of the path that precedes [query] and is split on ["/"].
|
@since 0.6 The field [path_components] is the part of the path that precedes [query] and is split on ["/"].
|
||||||
@since NEXT_RELEASE the type is a private alias
|
@since 0.11 the type is a private alias
|
||||||
@since NEXT_RELEASE the field [start_time] was added
|
@since 0.11 the field [start_time] was added
|
||||||
*)
|
*)
|
||||||
|
|
||||||
val pp : Format.formatter -> string t -> unit
|
val pp : Format.formatter -> string t -> unit
|
||||||
|
|
@ -287,7 +287,7 @@ module Request : sig
|
||||||
|
|
||||||
val start_time : _ t -> float
|
val start_time : _ t -> float
|
||||||
(** time stamp (from {!Unix.gettimeofday}) after parsing the first line of the request
|
(** time stamp (from {!Unix.gettimeofday}) after parsing the first line of the request
|
||||||
@since NEXT_RELEASE *)
|
@since 0.11 *)
|
||||||
|
|
||||||
val limit_body_size : max_size:int -> byte_stream t -> byte_stream t
|
val limit_body_size : max_size:int -> byte_stream t -> byte_stream t
|
||||||
(** Limit the body size to [max_size] bytes, or return
|
(** Limit the body size to [max_size] bytes, or return
|
||||||
|
|
@ -298,7 +298,7 @@ module Request : sig
|
||||||
val read_body_full : ?buf_size:int -> byte_stream t -> string t
|
val read_body_full : ?buf_size:int -> byte_stream t -> string t
|
||||||
(** Read the whole body into a string. Potentially blocking.
|
(** Read the whole body into a string. Potentially blocking.
|
||||||
|
|
||||||
@param buf_size initial size of underlying buffer (since NEXT_RELEASE) *)
|
@param buf_size initial size of underlying buffer (since 0.11) *)
|
||||||
|
|
||||||
(**/**)
|
(**/**)
|
||||||
(* for testing purpose, do not use *)
|
(* for testing purpose, do not use *)
|
||||||
|
|
@ -460,7 +460,7 @@ module Route : sig
|
||||||
val exact_path : string -> ('a,'b) t -> ('a,'b) t
|
val exact_path : string -> ('a,'b) t -> ('a,'b) t
|
||||||
(** [exact_path "foo/bar/..." r] is equivalent to
|
(** [exact_path "foo/bar/..." r] is equivalent to
|
||||||
[exact "foo" @/ exact "bar" @/ ... @/ r]
|
[exact "foo" @/ exact "bar" @/ ... @/ r]
|
||||||
@since NEXT_RELEASE **)
|
@since 0.11 **)
|
||||||
|
|
||||||
val pp : Format.formatter -> _ t -> unit
|
val pp : Format.formatter -> _ t -> unit
|
||||||
(** Print the route.
|
(** Print the route.
|
||||||
|
|
@ -476,7 +476,7 @@ end
|
||||||
A middleware can be inserted in a handler to modify or observe
|
A middleware can be inserted in a handler to modify or observe
|
||||||
its behavior.
|
its behavior.
|
||||||
|
|
||||||
@since NEXT_RELEASE
|
@since 0.11
|
||||||
*)
|
*)
|
||||||
module Middleware : sig
|
module Middleware : sig
|
||||||
type handler = byte_stream Request.t -> resp:(Response.t -> unit) -> unit
|
type handler = byte_stream Request.t -> resp:(Response.t -> unit) -> unit
|
||||||
|
|
@ -523,7 +523,7 @@ val create :
|
||||||
@param masksigpipe if true, block the signal {!Sys.sigpipe} which otherwise
|
@param masksigpipe if true, block the signal {!Sys.sigpipe} which otherwise
|
||||||
tends to kill client threads when they try to write on broken sockets. Default: [true].
|
tends to kill client threads when they try to write on broken sockets. Default: [true].
|
||||||
|
|
||||||
@param buf_size size for buffers (since NEXT_RELEASE)
|
@param buf_size size for buffers (since 0.11)
|
||||||
|
|
||||||
@param new_thread a function used to spawn a new thread to handle a
|
@param new_thread a function used to spawn a new thread to handle a
|
||||||
new client connection. By default it is {!Thread.create} but one
|
new client connection. By default it is {!Thread.create} but one
|
||||||
|
|
@ -543,7 +543,7 @@ val create :
|
||||||
used. This parameter exists since 0.10.
|
used. This parameter exists since 0.10.
|
||||||
|
|
||||||
@param get_time_s obtain the current timestamp in seconds.
|
@param get_time_s obtain the current timestamp in seconds.
|
||||||
This parameter exists since NEXT_RELEASE.
|
This parameter exists since 0.11.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
val addr : t -> string
|
val addr : t -> string
|
||||||
|
|
@ -591,7 +591,7 @@ val add_middleware :
|
||||||
@param stage specify when middleware applies.
|
@param stage specify when middleware applies.
|
||||||
Encoding comes first (outermost layer), then stages in increasing order.
|
Encoding comes first (outermost layer), then stages in increasing order.
|
||||||
@raise Invalid_argument if stage is [`Stage n] where [n < 1]
|
@raise Invalid_argument if stage is [`Stage n] where [n < 1]
|
||||||
@since NEXT_RELEASE
|
@since 0.11
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(** {2 Request handlers} *)
|
(** {2 Request handlers} *)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
It exposes a directory (and its subdirectories), with the optional ability
|
It exposes a directory (and its subdirectories), with the optional ability
|
||||||
to delete or upload files.
|
to delete or upload files.
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 0.11 *)
|
||||||
|
|
||||||
(** behavior of static directory.
|
(** behavior of static directory.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ val middleware :
|
||||||
?buf_size:int -> unit ->
|
?buf_size:int -> unit ->
|
||||||
Tiny_httpd.Middleware.t
|
Tiny_httpd.Middleware.t
|
||||||
(** Middleware responsible for deflate compression/decompression.
|
(** Middleware responsible for deflate compression/decompression.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.11 *)
|
||||||
|
|
||||||
val setup :
|
val setup :
|
||||||
?compress_above:int ->
|
?compress_above:int ->
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@
|
||||||
(deps (:bin ../examples/echo.exe))
|
(deps (:bin ../examples/echo.exe))
|
||||||
(locks /port)
|
(locks /port)
|
||||||
(enabled_if (= %{system} "linux"))
|
(enabled_if (= %{system} "linux"))
|
||||||
|
(package tiny_httpd_camlzip)
|
||||||
(action (with-stdout-to %{targets} (run ./echo1.sh %{bin}))))
|
(action (with-stdout-to %{targets} (run ./echo1.sh %{bin}))))
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(alias runtest)
|
(alias runtest)
|
||||||
|
(package tiny_httpd_camlzip)
|
||||||
(action (diff echo1.expect echo1.out)))
|
(action (diff echo1.expect echo1.out)))
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
|
|
@ -15,34 +17,40 @@
|
||||||
(deps (:bin ../examples/sse_server.exe))
|
(deps (:bin ../examples/sse_server.exe))
|
||||||
(locks /port)
|
(locks /port)
|
||||||
(enabled_if (= %{system} "linux"))
|
(enabled_if (= %{system} "linux"))
|
||||||
|
(package tiny_httpd)
|
||||||
(action (with-stdout-to %{targets} (run ./sse_count.sh %{bin}))))
|
(action (with-stdout-to %{targets} (run ./sse_count.sh %{bin}))))
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(alias runtest)
|
(alias runtest)
|
||||||
|
(package tiny_httpd)
|
||||||
(action (diff sse_count.expect sse_count.out)))
|
(action (diff sse_count.expect sse_count.out)))
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets upload-out)
|
(targets upload-out)
|
||||||
(deps (:bin ../src/bin/http_of_dir.exe) foo_50)
|
(deps (:bin ../src/bin/http_of_dir.exe) foo_50)
|
||||||
(locks /port)
|
(locks /port)
|
||||||
|
(package tiny_httpd)
|
||||||
(enabled_if (= %{system} "linux"))
|
(enabled_if (= %{system} "linux"))
|
||||||
(action (with-stdout-to %{targets}
|
(action (with-stdout-to %{targets}
|
||||||
(run ./upload_chunked.sh %{bin}))))
|
(run ./upload_chunked.sh %{bin}))))
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(alias runtest)
|
(alias runtest)
|
||||||
|
(package tiny_httpd)
|
||||||
(action (diff upload-out.expect upload-out)))
|
(action (diff upload-out.expect upload-out)))
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets dl-out)
|
(targets dl-out)
|
||||||
(deps (:bin ../src/bin/http_of_dir.exe) foo_50)
|
(deps (:bin ../src/bin/http_of_dir.exe) foo_50)
|
||||||
(locks /port)
|
(locks /port)
|
||||||
|
(package tiny_httpd)
|
||||||
(enabled_if (= %{system} "linux"))
|
(enabled_if (= %{system} "linux"))
|
||||||
(action (with-stdout-to %{targets}
|
(action (with-stdout-to %{targets}
|
||||||
(run ./download_chunked.sh %{bin}))))
|
(run ./download_chunked.sh %{bin}))))
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(alias runtest)
|
(alias runtest)
|
||||||
|
(package tiny_httpd)
|
||||||
(action (diff dl-out.expect dl-out)))
|
(action (diff dl-out.expect dl-out)))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.10"
|
version: "0.11"
|
||||||
authors: ["Simon Cruanes"]
|
authors: ["Simon Cruanes"]
|
||||||
maintainer: "simon.cruanes.2007@m4x.org"
|
maintainer: "simon.cruanes.2007@m4x.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.10"
|
version: "0.11"
|
||||||
authors: ["Simon Cruanes"]
|
authors: ["Simon Cruanes"]
|
||||||
maintainer: "simon.cruanes.2007@m4x.org"
|
maintainer: "simon.cruanes.2007@m4x.org"
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue