Module CamlGI.Cgi


module Cgi: sig .. end
(F)CGI high level functions

exception HttpError of int
module Request: sig .. end
val register_script : ?max_conns:int ->
?max_reqs:int ->
?sockaddr:Unix.sockaddr -> (Request.t -> unit) -> unit
Scripts must call register_script fn once to register their main function. This should be called last (nothing that follows will be executed).

The exception Exit is caught and ignored. CamlGI.Cgi.HttpError exceptions are turned into the appropriate error code. All other exceptions provoke a internal server error and are logged in the server error log.


max_conns : is the maximum of connections the web server can make to this script (default: None).
max_reqs : is the maximum of requests a web server can multiplex through a given connection (default: None).
sockaddr : the unix or the TCP/IP socket that the script will use to communicate with the web server. By default, the server uses Unix.stdin. For example, if your script is listening on port 8888 on a possibly remote machine, you can use Unix.ADDR_INET(Unix.inet_addr_any, 8888).

For FastCGI, the environment variable FCGI_WEB_SERVER_ADDRS may be used to specify a coma separated list of IP addresses from which the web server can connect. If not set, any address is accepted.

val random_sessionid : unit -> string
Generates a 128 bit (32 hex digits) random string which can be used for session IDs, random cookies and so on. The string returned will be very random and hard to predict, if the OS supports this feature.

Cgi


class type template = object .. end
Type of acceptable template objects.
exception Abort
Exception raised by all terminating cgi methods if the server requires to abort the request.

type upload_data = {
   upload_value : string;
   upload_filename : string;
   upload_content_type : string;
}
Type returned by cgi#upload method.
class cgi : ?post_max:int -> Request.t -> object .. end
new cgi ?post_max r creates a cgi object for the request r.
module Cgi_args: sig .. end

Apache names for HTTP errors


val cHTTP_CONTINUE : int
val cHTTP_SWITCHING_PROTOCOLS : int
val cHTTP_PROCESSING : int
val cHTTP_OK : int
val cHTTP_CREATED : int
val cHTTP_ACCEPTED : int
val cHTTP_NON_AUTHORITATIVE : int
val cHTTP_NO_CONTENT : int
val cHTTP_RESET_CONTENT : int
val cHTTP_PARTIAL_CONTENT : int
val cHTTP_MULTI_STATUS : int
val cHTTP_MULTIPLE_CHOICES : int
val cHTTP_MOVED_PERMANENTLY : int
val cHTTP_MOVED_TEMPORARILY : int
val cHTTP_SEE_OTHER : int
val cHTTP_NOT_MODIFIED : int
val cHTTP_USE_PROXY : int
val cHTTP_TEMPORARY_REDIRECT : int
val cHTTP_BAD_REQUEST : int
val cHTTP_UNAUTHORIZED : int
val cHTTP_PAYMENT_REQUIRED : int
val cHTTP_FORBIDDEN : int
val cHTTP_NOT_FOUND : int
val cHTTP_METHOD_NOT_ALLOWED : int
val cHTTP_NOT_ACCEPTABLE : int
val cHTTP_PROXY_AUTHENTICATION_REQUIRED : int
val cHTTP_REQUEST_TIME_OUT : int
val cHTTP_CONFLICT : int
val cHTTP_GONE : int
val cHTTP_LENGTH_REQUIRED : int
val cHTTP_PRECONDITION_FAILED : int
val cHTTP_REQUEST_ENTITY_TOO_LARGE : int
val cHTTP_REQUEST_URI_TOO_LARGE : int
val cHTTP_UNSUPPORTED_MEDIA_TYPE : int
val cHTTP_RANGE_NOT_SATISFIABLE : int
val cHTTP_EXPECTATION_FAILED : int
val cHTTP_UNPROCESSABLE_ENTITY : int
val cHTTP_LOCKED : int
val cHTTP_FAILED_DEPENDENCY : int
val cHTTP_INTERNAL_SERVER_ERROR : int
val cHTTP_NOT_IMPLEMENTED : int
val cHTTP_BAD_GATEWAY : int
val cHTTP_SERVICE_UNAVAILABLE : int
val cHTTP_GATEWAY_TIME_OUT : int
val cHTTP_VERSION_NOT_SUPPORTED : int
val cHTTP_VARIANT_ALSO_VARIES : int
val cHTTP_INSUFFICIENT_STORAGE : int
val cHTTP_NOT_EXTENDED : int
val cDOCUMENT_FOLLOWS : int
val cPARTIAL_CONTENT : int
val cMULTIPLE_CHOICES : int
val cMOVED : int
val cREDIRECT : int
val cUSE_LOCAL_COPY : int
val cBAD_REQUEST : int
val cAUTH_REQUIRED : int
val cFORBIDDEN : int
val cNOT_FOUND : int
val cMETHOD_NOT_ALLOWED : int
val cNOT_ACCEPTABLE : int
val cLENGTH_REQUIRED : int
val cPRECONDITION_FAILED : int
val cSERVER_ERROR : int
val cNOT_IMPLEMENTED : int
val cBAD_GATEWAY : int
val cVARIANT_ALSO_VARIES : int