(* debugging settings *)
let debug = false ;;
-let debug_level = `Debug ;;
+let debug_level = `Notice ;;
let debug_print s = if debug then prerr_endline s ;;
Http_common.debug := false ;;
Unix.environment ()
in
(* 4. We exec a new copy of uwobo *)
- Unix.execve Sys.executable_name [||] environment ;
- (* It should never reach this point *)
- assert false
+ Unix.execve Sys.executable_name [||] environment
) ()
| child when child > 0 ->
(* let's check if the new UWOBO started correctly *)
| None -> Http_daemon.respond_error ~code:(`Status (`Client_error `Bad_request)) outchan ;
end
| "/apply" ->
- let logger = new Uwobo_logger.processingLogger () in
+(* let logger = new Uwobo_logger.processingLogger () in *)
veillogger#clearMsgs;
let profile = try Some (req#param "profile") with _ -> None in
let password = try Some (req#param "password") with _ -> None in
return_error ("Uncaught exception: " ^ (Printexc.to_string exc)) outchan
;;
-let callback
- ~syslogger ~styles ~cmd_pipe ~res_pipe () (req: Http_types.request) outchan
-=
- HExtlib.finally
- (fun () -> try close_out outchan with Sys_error _ -> ())
- (callback ~syslogger ~styles ~cmd_pipe ~res_pipe () req) outchan
-
(* UWOBO's startup *)
let main () =
(* (1) system logger *)
debug_print (sprintf "Starting HTTP daemon on port %d ..." port);
(* next invocation doesn't return, process will keep on serving HTTP
requests until it will get killed by father *)
- Http_daemon.start'~port ~mode:`Fork
- (callback ~syslogger ~styles ~cmd_pipe ~res_pipe ())
+ let d_spec = Http_daemon.daemon_spec
+ ~port ~mode:`Fork
+ ~callback:(callback ~syslogger ~styles ~cmd_pipe ~res_pipe ())
+ ~auto_close:true ()
+ in
+ Http_daemon.main d_spec
| _ (* < 0 *) -> (* fork failed :-((( *)
failwith "Can't fork :-("
done