Module Netcgi_fcgi_10


module Netcgi_fcgi_10: sig .. end
Low-level FastCGI Wire Protocol


This code is copyright 2003 Eric Stokes, and may be used under either, the GNU GPL, or the same license as ocamlnet

This module impliments the low level fastcgi wire protocal. It exports simple functions to interact with the web server much as a standard cgi script would (eg. fastcgi_write_stdout, fastcgi_write_stderr), this is one of the design goals of the fastcgi protocal. This module is marginally usefull for making low level web apps by itself, though you should not mix calls to fcgi_write_* with transactional buffered output, unless you really like your, your helpdesk operators :P
exception FCGI_error of string * exn
val max_rec_size : int
The maximum record size for stdout, and stderr. If you try to send a record larger than this value to fcgi_write_stdout, or fcgi_write_stderr you will get an exception

type fcgiHeader = {
   version : int;
   rtype : int;
   requestid : int;
   contentlen : int;
   padlen : int;
}
protocal header

type fcgiBeginRequestBody = {
   role : int;
   flags : int;
}
begin request

type fcgiEndRequestBody = {
   astatus : int;
   pstatus : int;
}
end request

type fcgiRequest = {
   id : int;
   app_type : int;
   params : (string * string) list;
   stdin : string;
   data : string;
   con : Unix.file_descr;
}
fcgi params will return an asociation list fcgi stdin will return a string a full request record, what you get when you call fcgi_accept
val fcgi_accept : unit -> fcgiRequest
accept a fastcgi connection
val fcgi_destroy : fcgiRequest -> unit
tear down a connection after finishing with it
val fcgi_write_stdout : fcgiRequest -> string -> unit
write to fcgi stdout
val fcgi_write_stderr : fcgiRequest -> string -> unit
write to fcgi stderr
val fcgi_write_end_request : fcgiRequest -> fcgiEndRequestBody -> unit
write an end request record