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

« back to all changes in this revision

Viewing changes to src/netcgi1/netcgi_types.ml

  • 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_types.ml 1016 2006-10-02 13:58:45Z gerd $
2
 
 * ----------------------------------------------------------------------
3
 
 *
4
 
 *)
5
 
 
6
 
open Nethttp
7
 
 
8
 
exception Resources_exceeded
9
 
 
10
 
class type simple_message = Netmime.mime_body
11
 
 
12
 
type store =
13
 
  [ `Memory 
14
 
  | `File of string
15
 
  ]
16
 
 
17
 
 
18
 
type representation =
19
 
  [ `Simple of simple_message
20
 
  | `MIME of Netmime.mime_message
21
 
  ]
22
 
 
23
 
 
24
 
class type cgi_argument =
25
 
object
26
 
  method ro : bool
27
 
  method name : string
28
 
  method value : string
29
 
  method open_value_rd : unit -> Netchannels.in_obj_channel
30
 
  method store : store
31
 
  method content_type : string
32
 
  method content_type_params : (string * Mimestring.s_param) list
33
 
  method charset : string
34
 
  method filename : string option
35
 
  method representation : representation
36
 
  method set_value : string -> unit
37
 
  method open_value_wr : unit -> Netchannels.out_obj_channel
38
 
  method finalize : unit -> unit
39
 
end
40
 
 
41
 
 
42
 
type cgi_cookie = Nethttp.cookie =
43
 
    { cookie_name : string;
44
 
      cookie_value : string;
45
 
      cookie_expires : float option;
46
 
      cookie_domain : string option;
47
 
      cookie_path : string option;
48
 
      cookie_secure : bool;
49
 
    }
50
 
 
51
 
 
52
 
type status = http_status
53
 
 
54
 
type request_method =
55
 
  [ `GET
56
 
  | `HEAD
57
 
  | `POST
58
 
  | `DELETE
59
 
  | `PUT of cgi_argument
60
 
  ]
61
 
 
62
 
type cache_control =
63
 
    [ `No_cache
64
 
    | `Max_age of int
65
 
    | `Unspecified
66
 
    ]
67
 
 
68
 
type query_string_spec =
69
 
    [ `Initial | `Current | `Args of cgi_argument list | `None ]
70
 
 
71
 
type other_url_spec =
72
 
    [ `Env | `This of string | `None ]
73
 
 
74
 
class type cgi_activation =
75
 
object
76
 
  method environment : Netcgi_env.cgi_environment
77
 
 
78
 
  method request_method : request_method
79
 
 
80
 
  method initial_arguments : (string * cgi_argument) list
81
 
  method initial_argument : string -> cgi_argument
82
 
  method initial_argument_value : ?default:string -> string -> string
83
 
  method initial_multiple_argument : string -> cgi_argument list
84
 
 
85
 
  method arguments : (string * cgi_argument) list
86
 
  method argument : string -> cgi_argument
87
 
  method argument_value : ?default:string -> string -> string
88
 
  method multiple_argument : string -> cgi_argument list
89
 
 
90
 
  method set_arguments : ?fin:bool -> cgi_argument list -> unit
91
 
  method update_argument : ?fin:bool -> cgi_argument -> unit
92
 
  method update_multiple_argument : ?fin:bool -> cgi_argument list -> unit
93
 
  method delete_argument : ?fin:bool -> string -> unit
94
 
 
95
 
  method url : ?protocol:Netcgi_env.protocol ->   
96
 
               ?with_authority:other_url_spec ->
97
 
               ?with_script_name:other_url_spec ->
98
 
               ?with_path_info:other_url_spec ->
99
 
               ?with_query_string:query_string_spec ->
100
 
               unit ->
101
 
                 string
102
 
 
103
 
  method output : Netchannels.trans_out_obj_channel
104
 
 
105
 
  method set_header :
106
 
           ?status:status -> 
107
 
           ?content_type:string ->
108
 
           ?cache:cache_control ->
109
 
           ?filename:string ->
110
 
           ?language:string ->
111
 
           ?script_type:string ->
112
 
           ?style_type:string ->
113
 
           ?set_cookie:cgi_cookie list ->
114
 
           ?fields:(string * string list) list ->
115
 
           unit ->
116
 
             unit
117
 
  method set_redirection_header :
118
 
           string ->
119
 
             unit
120
 
 
121
 
  method finalize : unit -> unit
122
 
end