Class CamlGI.Cgi.cgi


class cgi : ?post_max:int -> Request.t -> object .. end
new cgi ?post_max r creates a cgi object for the request r. Note that you are advised not to create more than one cgi per request unless you know what you are doing.

post_max : set the maximum size for POSTed requests in bytes. This is a security feature to prevent clients from overrunning the server with data. The default is Sys.max_string_length, meaning no limit (besides OCaml ones).

method header : ?content_type:string ->
?cookie:Cookie.cookie ->
?cookies:Cookie.cookie list -> ?cookie_cache:bool -> unit -> unit
Emit the header. The default content type is "text/html".
method template : 'a.
?content_type:string ->
?cookie:Cookie.cookie ->
?cookies:Cookie.cookie list ->
?cookie_cache:bool -> (#template as 'a) -> unit
Emit the header (unless #header was issued before) followed by the given template.
Raises Failure if the output is not successful.
method exit : 'b. unit -> 'b
Exit the current cgi script. (You need not to call this at the end of your code, just if you want to exit earlier.)
method redirect : 'c.
?cookie:Cookie.cookie ->
?cookies:Cookie.cookie list -> ?cookie_cache:bool -> string -> 'c
#redirect ?cookie ?cookies url quits the current cgi script and send to the client a redirection header to url.
method url : unit -> string
Return the URL of the script.
method param : string -> string
#param name returns the "first" value of the parameter name.
Raises Not_found if name does not designate a valid parameter.
method param_all : string -> string list
#param_all name returns all the values of the parameter name.
Raises Not_found if name does not designate a valid parameter.
method param_exists : string -> bool
Return true iff the named parameter exists.
method param_true : string -> bool
This method returns false if the named parameter is missing, is an empty string, or is the string "0". Otherwise it returns true. Thus the intent of this is to return true in the Perl sense of the word. If a parameter appears multiple times, then this uses the first definition and ignores the others.
method params : (string * string) list
Return an assoc-list mapping name -> value for all parameters. Note that CGI scripts may have multiple values for a single name.
method is_multipart : bool
Returns true iff the request was a multipart/form-data POST request. Such requests are used when you need to upload files to a CGI script.
method upload : string -> upload_data
For multipart forms only. Returns the full upload data passed by the browser for a particular parameter.
Raises Not_found is no such parameter exists.
method upload_all : string -> upload_data list
For multipart forms only. As for #upload, but returns all uploads.
method cookie : string -> Cookie.cookie
Return the named cookie, or throw Not_found.
method cookies : Cookie.cookie list
Return a list of all cookies passed to the script.
method log : string -> unit
log s Log the message s into the webserver log.
method request : Request.t
Returns the original request object (passed in the constructor).