File: fcgi_raw.ml

package info (click to toggle)
ocamlnet 2.2.9-8
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 17,724 kB
  • ctags: 10,053
  • sloc: ml: 63,928; ansic: 1,973; makefile: 800; sh: 651
file content (32 lines) | stat: -rw-r--r-- 822 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
open Netcgi_fcgi_10

let _ =
  while true
  do
    let req = fcgi_accept () in
    let print s = 
      output_string stderr s;
      fcgi_write_stdout req s
    in
      fcgi_write_stdout req "Content-Type: text/plain\n\n";
      print "fastcgi request information\n";
      
      (* request type, app type *)
      print ("id: " ^ (string_of_int req.id) ^ "\n" ^
	     "app_type: " ^ (string_of_int req.app_type) ^ "\n");

      (* the params *)
      print "enviornment variables\n";
      List.iter
	(fun (name, valu) -> 
	   print (name ^ ": " ^ valu ^ "\n"))
	req.params;
      print "\n";

      (* stdin stderr records *)
      print ("stdin: " ^ req.stdin ^ "\n");
      print ("data: " ^ req.data ^ "\n");
      fcgi_write_end_request req {astatus=0;pstatus=0};
      fcgi_destroy req;
      flush_all()
  done