module Nethttpd_kernel: sig .. end
The protocol kernel of the HTTP daemon
This module mainly defines the http_protocol class which implements the
exchange of messages with a HTTP client. The request messages are represented
as sequence of req_token values. The response is encapsulated in a separate
http_response class. The contents of the response are represented as sequence
of resp_token values.
type fatal_error = [ `Broken_pipe
| `Message_too_long
| `Server_error
| `Timeout
| `Unix_error of Unix.error ]
These are the serious protocol violations after that the daemon stops
any further processing.
Note that `Timeout refers to a timeout in the middle of a request.
Long messages are fatal because it is suspected that they are denial
of service attacks. The kernel generates `Message_too_long only for
long headers, not for long bodies.
Fatal server errors can happen when exceptions are not properly handled.
As last resort the HTTP daemon closes the connection without notifying
the client.
val string_of_fatal_error : fatal_error -> string
Convert error to a string, for logging
type bad_request_error = [ `Bad_header
| `Bad_header_field of string
| `Bad_request_line
| `Bad_trailer
| `Format_error of string
| `Protocol_not_supported
| `Request_line_too_long
| `Unexpected_eof ]
A bad request is a violation where the current request cannot be
decoded, and it is not possible to accept further requests over the
current connection.
val string_of_bad_request_error : bad_request_error -> string
Convert error to a string, for logging
val status_of_bad_request_error : bad_request_error -> Nethttp.http_status
Returns the best response code for the error
type data_chunk = string * int * int
A data_chunk is a s="keywordsign">->
?in_header:Nethttp.http_header ->
?properties:(string * string) list ->
?in_channel:Netchannels.in_obj_channel ->
Nethttpd_types.extended_environment -> extended_environment
val output_static_response :
#Nethttpd_types.extended_environment ->
Nethttp.http_status -> Nethttp.http_header option -> string -> unit
val output_file_response :
#Nethttpd_types.extended_environment ->
Nethttp.http_status ->
Nethttp.http_header option -> string -> int64 -> int64 -> unit
class type min_config =
object
method config_error_response : int -> string
method config_log_error :
Unix.sockaddr option ->
Unix.sockaddr option ->
Nethttp.http_method option ->
Nethttp.http_header option -> string -> unit
end
val output_std_response :
#Nethttpd_types.min_config ->
#Nethttpd_types.extended_environment ->
Nethttp.http_status ->
Nethttp.http_header option -> string option -> unit
exception Redirect_request of string * Nethttp.http_header
exception Redirect_response of string * Nethttp.http_header
class type http_service_generator =
object
method generate_response : Nethttpd_types.extended_environment -> unit
end
class type http_service_receiver =
object
method process_body :
Nethttpd_types.extended_environment ->
Nethttpd_types.http_service_generator
end
type http_service_reaction =
[ `Accept_body of Nethttpd_types.http_service_receiver
| `File of
Nethttp.http_status * Nethttp.http_header option * string * int64 *
int64
| `Reject_body of Nethttpd_types.http_service_generator
| `Static of Nethttp.http_status * Nethttp.http_header option * string
| `Std_response of
Nethttp.http_status * Nethttp.http_header option * string option ]
class type ['a] http_service =
object
method def_term : 'a
method name : string
method print : Format.formatter -> unit
method process_header :
Nethttpd_types.extended_environment ->
Nethttpd_types.http_service_reaction
end
val update_alist : ('a * 'b) list -> ('a * 'b) list -> ('a * 'b) list
end