mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
wip: IO streams
This commit is contained in:
parent
460492ded0
commit
76408b7e39
2 changed files with 31 additions and 5 deletions
|
|
@ -1,9 +1,14 @@
|
|||
type input_stream = (bytes -> int -> int -> int) * (unit -> unit)
|
||||
(** An input stream is a function to read bytes into a buffer,
|
||||
and a function to close *)
|
||||
|
||||
(** An input stream. *)
|
||||
type input_stream = {
|
||||
ic: in_channel;
|
||||
mutable buf: bytes;
|
||||
}
|
||||
type output_stream = (bytes -> int -> int -> unit) * (unit -> unit) * (unit -> unit)
|
||||
(** An output stream is a function to output bytes, a function to [flush],
|
||||
and a function to close. *)
|
||||
|
||||
module Input_stream = struct
|
||||
|
||||
end
|
||||
|
||||
exception Bad_req of int * string
|
||||
let bad_reqf c fmt = Printf.ksprintf (fun s ->raise (Bad_req (c,s))) fmt
|
||||
|
|
|
|||
|
|
@ -1,3 +1,24 @@
|
|||
type input_stream = (bytes -> int -> int -> int) * (unit -> unit)
|
||||
(** An input stream is a function to read bytes into a buffer,
|
||||
and a function to close *)
|
||||
|
||||
type output_stream = (bytes -> int -> int -> unit) * (unit -> unit) * (unit -> unit)
|
||||
(** An output stream is a function to output bytes, a function to [flush],
|
||||
and a function to close. *)
|
||||
|
||||
module Input_stream : sig
|
||||
type t = input_stream
|
||||
|
||||
val of_chan : in_channel -> t
|
||||
val of_string : string -> t
|
||||
val of_bytes : bytes -> t
|
||||
end
|
||||
|
||||
module Output_stream : sig
|
||||
type t = output_stream
|
||||
|
||||
val of_chan : out_channel -> t
|
||||
end
|
||||
|
||||
module Meth : sig
|
||||
type t = [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue