package simple_httpd
Module Simple_httpd.InputSource
Representation of input streams, can be generated from string, file, ...
Input streams are used to represent a series of bytes that can arrive progressively. For example, an uploaded file will be sent as a series of chunks.
A buffered stream, with a view into the current buffer (or refill if empty), and a function to consume n bytes.
val make :
?bs:bytes ->
?close:(t -> unit) ->
consume:(t -> int -> unit) ->
fill:(t -> unit) ->
unit ->
tmake ~fill () creates a byte stream.
Make a buffered stream from the given channel.
Make a buffered stream from the given file descriptor.
Make a buffered stream from the given http client's socket.
Allow a to Make a buffered stream from the given Io.t. The call will be scheduled if read blocks.
A stream that just returns the slice of bytes starting from i and of length len.
Module type for filling an input buffer by printing. A module of this type is openned in <ML> section of .chamel file when using vfs_pack.
Make a buffered stream from a function that will call the echo and printf function from the provided module. Using effect, the function producing the output is called lazily when it is needed to fill the buffer.
Write the stream to the channel.
Open a file with given name, and obtain an input stream on its content. When the function returns, the stream (and file) are closed.
returns true if we are at the end of the input (self.len = 0 and fill returns 0)
the chracter '\255'
really_input inp bytes off len reads exactly len bytes from inp and write then to bytes from offset may raise End_of_file of Invalid_argument if bytes is to small
Advance in the stream until in meet the given target.
read_exactly ~size bs returns a new stream that reads exactly size bytes from bs, and then closes.
The following are a minimal set of non backtracking parsing combinators with no allocation. They use Input.eof when the stream is empty
repeat parsing 0 or more time, fail if partial parsing of one more item is possible
repeat parsing 1 or more time, fail if partial parsing of one more item is possible