Skip to content

Commit

Permalink
chore: Apply OCamlFormat 0.26.2 (#1044)
Browse files Browse the repository at this point in the history
Fix bad documentation markup.

Signed-off-by: Antonin Décimo <[email protected]>
Co-authored-by: Antonin Décimo <[email protected]>
  • Loading branch information
rgrinberg and MisterDA committed Jun 24, 2024
1 parent b0dfbde commit 7020e63
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 0.25.1
version = 0.26.2
profile=conventional
break-infix=fit-or-vertical
parse-docstrings=true
2 changes: 1 addition & 1 deletion cohttp-async/src/server.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type response_action =
val respond : response respond_t

val resolve_local_file : docroot:string -> uri:Uri.t -> string
[@@deprecated "Please use Cohttp.Path.resolve_local_file. "]
[@@deprecated "Please use Cohttp.Path.resolve_local_file. "]
(** Resolve a URI and a docroot into a concrete local filename. *)

val respond_with_pipe :
Expand Down
10 changes: 6 additions & 4 deletions cohttp-eio/src/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ let make_expert ?conn_closed ~callback () =
let make ?(conn_closed = fun _ -> ()) ~callback () =
{
conn_closed;
handler = (fun conn request body _ic oc -> callback conn request body (request, oc));
handler =
(fun conn request body _ic oc -> callback conn request body (request, oc));
}
let read input =
Expand Down Expand Up @@ -90,13 +91,14 @@ let write output (response : Cohttp.Response.t) body =
in
Eio.Buf_write.flush output
let respond ?(headers = Cohttp.Header.init ()) ?flush ~status ~body () (request, oc) =
let respond ?(headers = Cohttp.Header.init ()) ?flush ~status ~body ()
(request, oc) =
let keep_alive = Http.Request.is_keep_alive request in
let headers =
match Cohttp.Header.connection headers with
| None ->
Http.Header.add headers "connection"
(if keep_alive then "keep-alive" else "close")
Http.Header.add headers "connection"
(if keep_alive then "keep-alive" else "close")
| Some _ -> headers
in
let response = Cohttp.Response.make ~headers ?flush ~status () in
Expand Down
2 changes: 1 addition & 1 deletion cohttp-lwt-unix/src/server.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
include Cohttp_lwt.S.Server with module IO = Io

val resolve_file : docroot:string -> uri:Uri.t -> string
[@@deprecated "Please use Cohttp.Path.resolve_local_file. "]
[@@deprecated "Please use Cohttp.Path.resolve_local_file. "]

val respond_file :
?headers:Http.Header.t ->
Expand Down
8 changes: 4 additions & 4 deletions cohttp-lwt/src/connection_cache.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module Make_no_cache (Connection : S.Connection) : sig
include S.Connection_cache

val create : ?ctx:Connection.Net.ctx -> unit -> t
(** [create ?ctx ()] creates a connection for handling a single
request. The connection accepts only a single request and will
automatically be closed as soon as possible.
@param ctx See {Connection.Net.ctx} *)
(** [create ?ctx ()] creates a connection for handling a single request. The
connection accepts only a single request and will automatically be closed
as soon as possible.
@param ctx See {!Connection.Net.ctx} *)
end = struct
module Net = Connection.Net
module IO = Net.IO
Expand Down
53 changes: 26 additions & 27 deletions cohttp-lwt/src/s.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,32 +79,31 @@ type call =
Http.Method.t ->
Uri.t ->
(Cohttp.Response.t * Body.t) Lwt.t
(** [call ?headers ?body method uri]
Function type used to handle http requests
@return [(response, response_body)]
[response_body] is not buffered, but stays on the wire until
consumed. It must therefore be consumed in a timely manner.
Otherwise the connection would stay open and a file descriptor leak
may be caused. Following responses would get blocked.
Functions in the {!Body} module can be used to consume [response_body].
Use {!Body.drain_body} if you don't consume the body by other means.
Leaks are detected by the GC and logged as debug messages, these can
be enabled activating the debug logging. For example, this can be
done as follows in [cohttp-lwt-unix]
{[
Cohttp_lwt_unix.Debug.activate_debug ();
Logs.set_level (Some Logs.Warning)
]}
@raise {!exception Connection.Retry} on recoverable errors like the remote
endpoint closing
the connection gracefully. Even non-idempotent requests are
guaranteed to not have been processed by the remote endpoint and
should be retried. But beware that a [`Stream] [body] may have been
consumed. *)
(** [call ?headers ?body method uri] Function type used to handle http requests
@return
[(response, response_body)] [response_body] is not buffered, but stays on
the wire until consumed. It must therefore be consumed in a timely manner.
Otherwise the connection would stay open and a file descriptor leak may be
caused. Following responses would get blocked. Functions in the {!Body}
module can be used to consume [response_body]. Use {!Body.drain_body} if
you don't consume the body by other means.
Leaks are detected by the GC and logged as debug messages, these can be
enabled activating the debug logging. For example, this can be done as
follows in
[cohttp-lwt-unix]
{[
Cohttp_lwt_unix.Debug.activate_debug ();
Logs.set_level (Some Logs.Warning)
]}
@raise {!exception:Connection.Retry}
on recoverable errors like the remote endpoint closing the connection
gracefully. Even non-idempotent requests are guaranteed to not have been
processed by the remote endpoint and should be retried. But beware that a
[`Stream] [body] may have been consumed. *)

(** The [Connection] module handles a single, possibly pipelined, http
connection. *)
Expand Down Expand Up @@ -232,7 +231,7 @@ module type Server = sig
and type response = Http.Response.t * Body.t

val resolve_local_file : docroot:string -> uri:Uri.t -> string
[@@deprecated "Please use Cohttp.Path.resolve_local_file. "]
[@@deprecated "Please use Cohttp.Path.resolve_local_file. "]
(** Resolve a URI and a docroot into a concrete local filename. *)

val respond_error :
Expand Down
6 changes: 3 additions & 3 deletions cohttp-mirage/src/cohttp_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
module IO = Io.Make

module Net = Net.Make
(** The resulting {modtype:Cohttp_lwt.S.Net} module can be used to build the
low-level client interfaces with {module:Cohttp_lwt.Connection.Make} and
from that {module:Cohttp_lwt.Connection_cache.Make}. *)
(** The resulting {!modtype:Cohttp_lwt.S.Net} module can be used to build the
low-level client interfaces with {!module:Cohttp_lwt.Connection.Make} and
from that {!module:Cohttp_lwt.Connection_cache.Make}. *)

(** client modules *)

Expand Down
2 changes: 1 addition & 1 deletion cohttp/src/accept.mli
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type encoding = Accept_types.encoding =
[@@deriving sexp]

(** Basic language range tag. ["en-gb"] is represented as
[Language \["en"; "gb"\]].
[Language ["en"; "gb"]].
@see <https://tools.ietf.org/html/rfc7231#section-5.3.5> the specification. *)
type language = Accept_types.language = Language of string list | AnyLanguage
Expand Down
2 changes: 1 addition & 1 deletion cohttp/src/header.mli
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ val replace : t -> string -> string -> t
(** [replace h k v] replaces the last added value of [k] from [h] and removed
all other occurences of [k] if it exists. Otherwise it adds [(k, v)] to [h].
{e Invariant:} [forall h, k, v. get_multi (replace h k v) = \[ v \]] *)
{e Invariant:} [forall h, k, v. get_multi (replace h k v) = [ v ]] *)

val mem : t -> string -> bool
(** [mem h k] returns [true] if the header name [k] appears in [h] and [false]
Expand Down
2 changes: 1 addition & 1 deletion cohttp/src/s.ml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ module type Response = sig
val version : t -> Code.version
val status : t -> Code.status_code

val flush : (t -> bool)
val flush : t -> bool
[@@deprecated "this field will be removed in the future"]

val compare : t -> t -> int
Expand Down
5 changes: 2 additions & 3 deletions http/src/http.mli
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ module Header : sig
all other occurences of [k] if it exists. Otherwise it adds [(k, v)] to
[h].
{e Invariant:} [forall h, k, v. get_multi (replace h k v) = \[ v \]] *)
{e Invariant:} [forall h, k, v. get_multi (replace h k v) = [ v ]] *)

val mem : t -> string -> bool
(** [mem h k] returns [true] if the header name [k] appears in [h] and [false]
Expand Down Expand Up @@ -464,8 +464,7 @@ module Response : sig
val version : t -> Version.t
val status : t -> Status.t

val flush :
(t -> bool)
val flush : t -> bool
[@@deprecated
"this field will be removed in the future. Provide flush in the \
[respond_*] function instead."]
Expand Down

0 comments on commit 7020e63

Please sign in to comment.