Docs GODI Archive
Projects Blog Knowledge

Look up function:

(e.g. "List.find" or "keysym")
More options

Class Netcgi_common.cgi_environment


class cgi_environment : config:config -> properties:(string * string) list -> input_header:(string * string) list -> Netchannels.out_obj_channel -> object .. end
new cgi_environment ~config ~properties ~input_header out_obj generates a Netcgi.cgi_environment object, from the arguments. The creation of such an object does not raise any exception. The method #out_channel of the created environment returns out_obj.
config : give the configuration options. Of particular interest here is config.workarounds. If `MSIE_Content_type_bug is present, a fix will be applied to input_header.
properties : CGI-like properties as (name, value) pairs. Examples: ("REQUEST_METHOD", "POST"), ("SERVER_PROTOCOL", "HTTP/1.1"). Note that "CONTENT_TYPE" and "CONTENT_LENGTH" are part of the input header. It is highly recommended to use Netcgi_common.update_props_inheader to build this list.
input_header : is a list of (field, value) pairs of the HTTP input request. It is ASSUMED that field names in input_header are lowercase in order to apply a fix to the MSIE Content-Type bug. Also remember that the separator is '-', not '_'. Both requirements will be stafisfied if you use Netcgi_common.update_props_inheader to build input_header.

Notes: The header is kept into variables and #send_output_header sents it directly to out_obj. This has several advantages:

  • It is possible to change header fields at every moment before the commitment happens. For example, it is possible to set the content-length field which is normally only known just at the time of the commit operation.
  • The environment object can process the header; for example it can fix header fields.
  • It is simpler to connect to environments which transport the header in non-standard ways. Example: Assume that the environment is the web server process (e.g. we are an Apache module). Typically the header must be stored in different structures than the body of the message.

val mutable header_not_sent : bool
true iff the output headers have not been sent. #send_output_header must set it to false once it did its job.
method cgi_gateway_interface : string
method cgi_server_name : string
method cgi_server_port : int option
method cgi_server_protocol : string
method cgi_server_software : string
method cgi_request_method : string
method cgi_script_name : string
method cgi_path_info : string
method cgi_path_translated : string
method cgi_auth_type : string
method cgi_remote_addr : string
method cgi_remote_host : string
method cgi_remote_user : string
method cgi_remote_ident : string
method cgi_query_string : string
method protocol : Nethttp.protocol
method cgi_property : ?default:string -> string -> string
method cgi_properties : (string * string) list
Return the parameter properties.
method cgi_https : bool
Raises HTTP if the HTTPS property is not understood.
method input_header : Netmime.mime_header
For special header structures, just override this method.
method input_header_field : ?default:string -> string -> string
method multiple_input_header_field : string -> string list
method input_header_fields : (string * string) list
method cookie : string -> Cookie.t
method cookies : Cookie.t list
method user_agent : string
method input_content_length : int
method input_content_type_string : string
method input_content_type : unit -> string * (string * Mimestring.s_param) list
method output_header : Netmime.mime_header
For special header structures, override this method and maybe #send_output_header.
method output_header_field : ?default:string -> string -> string
method multiple_output_header_field : string -> string list
method output_header_fields : (string * string) list
method set_output_header_field : string -> string -> unit
method set_multiple_output_header_field : string -> string list -> unit
method set_output_header_fields : (string * string) list -> unit
method set_status : Nethttp.http_status -> unit
method send_output_header : unit -> unit
method output_ch : Netchannels.out_obj_channel
Deprecated.Use #out_channel instead.
method out_channel : Netchannels.out_obj_channel
method log_error : string -> unit
You may want to override this with your custom logging method. By default, #log_error msg adds a timestamp to msg and sends th result to stderr.
method config : config
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml