~ubuntu-branches/ubuntu/trusty/ocamlnet/trusty

« back to all changes in this revision

Viewing changes to src/netcgi1/netcgi_jserv_ajp12.mli

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-09-02 14:12:33 UTC
  • mfrom: (18.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110902141233-zbj0ygxb92u6gy4z
Tags: 3.4-1
* New upstream release
  - add a new NetcgiRequire directive to ease dependency management
    (Closes: #637147)
  - remove patches that were applied upstream:
    + Added-missing-shebang-lines-in-example-shell-scripts
    + Try-also-ocamlc-for-POSIX-threads

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
(* $Id: netcgi_jserv_ajp12.mli 1016 2006-10-02 13:58:45Z gerd $
2
 
 * ----------------------------------------------------------------------
3
 
 *
4
 
 *)
5
 
 
6
 
(** Implementation of the AJP/1.2 protocol *)
7
 
 
8
 
(** This module implements the core of the AJP/1.2 protocol. This protocol is supported
9
 
 * by both the old mod_jserv and by the newer mod_jk (Jakarta/Tomcat).
10
 
 * Note however, that mod_jserv passes more variables, and that it is fully CGI
11
 
 * compatible. In contrast to this, mod_jk omits some variables (e.g.
12
 
 * PATH_INFO, and SCRIPT_NAME). These variables must be fixed by special
13
 
 * rules, see below. Furthermore, mod_jk has a different format
14
 
 * of the property file, but it is not (yet) accepted by this library.
15
 
 * mod_jk does not support authentication for AJP/1.2. So try to get 
16
 
 * mod_jserv if possible.
17
 
 *)
18
 
 
19
 
open Netcgi_jserv
20
 
open Netchannels
21
 
 
22
 
val serve_connection : 
23
 
      ?config:(Netcgi_env.cgi_config) ->
24
 
      ?https:bool ->                           (* default: false *)
25
 
      ?jk_servletSubString:string ->           (* default: "/servlets/" *)
26
 
      (string option -> string option -> Netcgi_env.cgi_environment -> unit) ->
27
 
        (* request handler *)
28
 
      auth option ->
29
 
      in_obj_channel ->
30
 
      out_obj_channel ->
31
 
        unit
32
 
  (** Serves the connection designated by the [in_obj_channel] and the
33
 
   * [out_obj_channel]. The function ensures that both channels are closed
34
 
   * before it returns to the caller (and before it raises an exception).
35
 
   * 
36
 
   * If an authentication record [auth] is passed, the connection is authenticated
37
 
   * first. If this fails, the channels will be closed immediately, and the
38
 
   * function will return normally.
39
 
   *
40
 
   * The request is read from the [in_obj_channel], and a [cgi_environment]
41
 
   * is created from it. The request handler is called with this
42
 
   * environment and two extra string option arguments. The first is the
43
 
   * zone, and the second is the servlet identifier. The request handler
44
 
   * may look like a small CGI program:
45
 
   *
46
 
   * {[
47
 
   * (fun zone servlet env ->
48
 
   *   let cgi = new std_activation ~env () in
49
 
   *   cgi # set_header();
50
 
   *   cgi # output # output_string  "Hello world!";
51
 
   *   cgi # output # commit_work();
52
 
   * )
53
 
   * ]}
54
 
   *
55
 
   * If the request arriving at the [in_obj_channel] is a signal, the function
56
 
   * will close both channels, and will raise either [Signal_restart] or 
57
 
   * [Signal_shutdown].
58
 
   *
59
 
   * @param config This is the configuration of the [cgi_environment]. It defaults
60
 
   *   to {!Netcgi_env.default_config}
61
 
   * @param https Because AJP/1.2 does not pass the [HTTPS] variable, it is necessary
62
 
   *   to set this argument to [true] if the server is secure.
63
 
   * @param jk_servletSubString The fields [servlet], [path_info], and [script_name]
64
 
   *   are always empty if mod_jk is used. There is a fixup routine that
65
 
   *   is controlled by this optional argument, and that will be invoked if
66
 
   *   servlet is empty. The fixup is
67
 
   *   that the string [jk_servletSubString] is searched in the request URI,
68
 
   *   and if it is found, the following modifications will be applied:
69
 
   *   The [servlet] is set to the path component following [jk_servletSubString].
70
 
   *   The [path_info] is set to the rest of the URI. The [script_name] is set
71
 
   *   to the beginning of the URI until the servlet name (inclusive).
72
 
   *   Other fields are not modified. If the string [jk_servletSubString] is
73
 
   *   not found, or if it is the empty string, the [servlet] name and the
74
 
   *   [script_name] will be set to the request URI, and the [path_info] will be set
75
 
   *   to the empty string.
76
 
   *)