/[svn]/driver/webiface.ml
ViewVC logotype

Diff of /driver/webiface.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 97 by abate, Tue Jul 10 17:06:02 2007 UTC revision 98 by abate, Tue Jul 10 17:06:05 2007 UTC
# Line 1  Line 1 
1    (* TODO:
2       - correct error messages, not failwith "..."
3       - HTML design, logo
4       - dump
5    *)
6    
7  open Netcgi  open Netcgi
8    
9    (* Configuration *)
10    
11  let session_dir = "/home/frisch/sessions"  let session_dir = "/home/frisch/sessions"
12  let timeout = 60  (* seconds *)  let timeout = 60 * 5  (* seconds *)
13  let max_sess = 5  let max_sess = 10
14    
15    (*****************)
16    
17    
18  let persistant = ref false  let persistant = ref false
19  let session_id = ref ""  let session_id = ref ""
# Line 93  Line 104 
104        | `Open ->        | `Open ->
105            if (nb_sessions >= max_sess) then            if (nb_sessions >= max_sess) then
106              failwith "Too many open sessions ...";              failwith "Too many open sessions ...";
107            gen_session_id ()            let sid = gen_session_id () in
108              (* touch the session file ... *)
109              let chan = open_out_bin (session_file sid) in
110              close_out chan;
111              sid
112        | `Close -> close_session (cgi # argument_value "session"); ""        | `Close -> close_session (cgi # argument_value "session"); ""
113        | `New ->  ""        | `New ->  ""
114        | _ -> cgi # argument_value "session"        | _ -> cgi # argument_value "session"
# Line 114  Line 129 
129        if !persistant then (        if !persistant then (
130          try          try
131            let chan = open_in_bin (session_file !session_id) in            let chan = open_in_bin (session_file !session_id) in
132            let s = Marshal.from_channel chan in            if in_channel_length chan > 0 then
133                (let s = Marshal.from_channel chan in
134                 State.set s);
135            close_in chan;            close_in chan;
136            State.set s;          with Sys_error _ ->
137          with Sys_error _ -> ()            failwith "This session has expired ..."
138        );        );
139    
140        let ok = Cduce.run ppf input in        let ok = Cduce.run ppf input in

Legend:
Removed from v.97  
changed lines
  Added in v.98

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5