module Netcgi_jserv_ajp12:Implementation of the AJP/1.2 protocolsig
..end
val serve_connection : ?config:Netcgi_env.cgi_config ->
?https:bool ->
?jk_servletSubString:string ->
(string option -> string option -> Netcgi_env.cgi_environment -> unit) ->
Netcgi_jserv.auth option ->
Netchannels.in_obj_channel -> Netchannels.out_obj_channel -> unit
in_obj_channel
and the
out_obj_channel
. The function ensures that both channels are closed
before it returns to the caller (and before it raises an exception).
If an authentication record auth
is passed, the connection is authenticated
first. If this fails, the channels will be closed immediately, and the
function will return normally.
The request is read from the in_obj_channel
, and a cgi_environment
is created from it. The request handler is called with this
environment and two extra string option arguments. The first is the
zone, and the second is the servlet identifier. The request handler
may look like a small CGI program:
(fun zone servlet env ->
let cgi = new std_activation ~env () in
cgi # set_header();
cgi # output # output_string "Hello world!";
cgi # output # commit_work();
)
If the request arriving at the in_obj_channel
is a signal, the function
will close both channels, and will raise either Signal_restart
or
Signal_shutdown
.
https
: Because AJP/1.2 does not pass the HTTPS
variable, it is necessary
to set this argument to true
if the server is secure.jk_servletSubString
: The fields servlet
, path_info
, and script_name
are always empty if mod_jk is used. There is a fixup routine that
is controlled by this optional argument, and that will be invoked if
servlet is empty. The fixup is
that the string jk_servletSubString
is searched in the request URI,
and if it is found, the following modifications will be applied:
The servlet
is set to the path component following jk_servletSubString
.
The path_info
is set to the rest of the URI. The script_name
is set
to the beginning of the URI until the servlet name (inclusive).
Other fields are not modified. If the string jk_servletSubString
is
not found, or if it is the empty string, the servlet
name and the
script_name
will be set to the request URI, and the path_info
will be set
to the empty string.