Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file s.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168(*{{{ Copyright (C) 2012-2014 Anil Madhavapeddy <anil@recoil.org>
* Copyright (c) 2014 Rudi Grinberg
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
}}}*)(** Module type signatures for Cohttp components *)(** The [IO] module defines the blocking interface for reading and writing to
Cohttp streams *)moduletypeIO=sigtype+'at(** ['a t] represents a blocking monad state *)val(>>=):'at->('a->'bt)->'bt(** [a >>= b] will pass the result of [a] to the [b] function. This is a
monadic [bind]. *)valreturn:'a->'at(** [return a] will construct a constant IO value. *)typeic(** [ic] represents an input channel *)typeoc(** [oc] represents an output channel *)typeconn(** [conn] represents the underlying network flow *)valrefill:ic->[`Ok|`Eof]tvalwith_input_buffer:ic->f:(string->pos:int->len:int->'a*int)->'avalread_line:ic->stringoptiont(** [read_line ic] will read a single line terminated by CR or CRLF from the
input channel [ic]. It returns {!None} if EOF or other error condition is
reached. *)valread:ic->int->stringt(** [read ic len] will block until a maximum of [len] characters are read from
the input channel [ic]. It returns an empty string if EOF or some other
error condition occurs on the input channel, and can also return fewer
than [len] characters if input buffering is not sufficient to satisfy the
request. *)valwrite:oc->string->unitt(** [write oc s] will block until the complete [s] string is written to the
output channel [oc]. *)valflush:oc->unitt(** [flush oc] will return when all previously buffered content from calling
{!write} have been written to the output channel [oc]. *)endmoduletypeHttp_io=sigtypettypereadertypewritermoduleIO:IOvalread:IO.ic->[`Eof|`Invalidofstring|`Okoft]IO.tvalmake_body_writer:flush:bool->t->IO.oc->writervalmake_body_reader:t->IO.ic->readervalread_body_chunk:reader->Transfer.chunkIO.tvalwrite_header:t->IO.oc->unitIO.tvalwrite_body:writer->string->unitIO.tvalwrite:flush:bool->(writer->unitIO.t)->t->IO.oc->unitIO.tendmoduletypeRequest=sigtypet={headers:Header.t;(** HTTP request headers *)meth:Code.meth;(** HTTP request method *)resource:string;(** Request path and query *)version:Code.version;(** HTTP version, usually 1.1 *)}[@@derivingsexp]valheaders:t->Header.tvalmeth:t->Code.methvalresource:t->stringvalversion:t->Code.versionvalencoding:t->Transfer.encodingvalcompare:t->t->intvalmake:?meth:Code.meth->?version:Code.version->?encoding:Transfer.encoding->?headers:Header.t->Uri.t->t(** [make ()] is a value of {!type:t}. The default values for the request, if
not specified, are: [status] is [`Ok], [version] is [`HTTP_1_1], [flush]
is [false] and [headers] is [Header.empty]. The request encoding value is
determined via the [Header.get_transfer_encoding] function and, if not
found, uses the default value [Transfer.Fixed 0]. *)valis_keep_alive:t->bool(** Return true whether the connection should be reused *)valuri:t->Uri.tvalmake_for_client:?headers:Header.t->?chunked:bool->?body_length:int64->Code.meth->Uri.t->tendmoduletypeResponse=sigtypet={headers:Header.t;(** response HTTP headers *)version:Code.version;(** (** HTTP version, usually 1.1 *) *)status:Code.status_code;(** HTTP status code of the response *)}[@@derivingsexp]valencoding:t->Transfer.encodingvalheaders:t->Header.tvalversion:t->Code.versionvalstatus:t->Code.status_codevalcompare:t->t->intvalmake:?version:Code.version->?status:Code.status_code->?encoding:Transfer.encoding->?headers:Header.t->unit->t(** [make ()] is a value of {!type:t}. The default values for the request, if
not specified, are: [status] is [`Ok], [version] is [`HTTP_1_1], [flush]
is [false] and [headers] is [Header.empty]. The request encoding value is
determined via the [Header.get_transfer_encoding] function and, if not
found, uses the default value [Transfer.Chunked]. *)endmoduletypeBody=sigtypetvalto_string:t->stringvalto_string_list:t->stringlistvalto_form:t->(string*stringlist)listvalempty:tvalis_empty:t->boolvalof_string:string->tvalof_string_list:stringlist->tvalof_form:?scheme:string->(string*stringlist)list->tvalmap:(string->string)->t->tvaltransfer_encoding:t->Transfer.encodingend