start
[camlunity.git] / request.ml
blob38d23e5164247fffc1b65bf31f98f0b8c821705b
2 open Printf
3 open Netcgi
5 let main (cgi:cgi) =
6 let env = cgi#environment in
7 let cgi_arg name = try Some (cgi#argument name)#value with _ -> None in
8 let outs = cgi#out_channel#output_string in
9 let out fmt = ksprintf outs fmt in
11 let dump_cgi () =
12 out "cgi_properties\n";
13 List.iter (fun (k,v) -> out "%s = %s\n" k v) env#cgi_properties;
14 out "input_header_fields\n";
15 List.iter (fun (k,v) -> out "%s = %s\n" k v) env#input_header_fields;
16 out "cgi_arguments\n";
17 List.iter (fun x -> out "%s = %s\n" x#name x#value) cgi#arguments
20 cgi#set_header ~cache:`No_cache ~content_type:"text/plain" ();
21 dump_cgi ();
25 let main (cgi:cgi) =
26 try
27 main cgi;
28 cgi#out_channel#commit_work ();
29 with
30 _ -> cgi#out_channel#rollback_work ()