4 module Stack = Continuationals.Stack
6 let rt_path () = Helm_registry.get "matita.rt_base_dir"
8 let libdir uid = (rt_path ()) ^ "/users/" ^ uid
10 let utf8_length = Netconversion.ustring_length `Enc_utf8
12 (*** from matitaScript.ml ***)
13 (* let only_dust_RE = Pcre.regexp "^(\\s|\n|%%[^\n]*\n)*$" *)
15 let eval_statement include_paths (* (buffer : GText.buffer) *) status (* script *)
18 let ast,unparsed_text =
21 (* if Pcre.pmatch ~rex:only_dust_RE text then raise Margin; *)
23 GrafiteParser.parsable_statement status
24 (Ulexing.from_utf8_string text) in
25 let ast = MatitaEngine.get_ast status include_paths strm in
27 | `Ast (st, text) -> st, text
29 let floc = match ast with
30 | GrafiteAst.Executable (loc, _)
31 | GrafiteAst.Comment (loc, _) -> loc in
33 let _,lend = HExtlib.loc_of_floc floc in
34 let parsed_text, _parsed_text_len =
35 HExtlib.utf8_parsed_text unparsed_text (HExtlib.floc_of_loc (0,lend)) in
36 let byte_parsed_text_len = String.length parsed_text in
38 String.sub unparsed_text byte_parsed_text_len
39 (String.length unparsed_text - byte_parsed_text_len)
43 MatitaEngine.eval_ast ~include_paths ~do_heavy_checks:false status ("",0,ast)
45 (status, parsed_text, unparsed_txt'),"",(*parsed_text_len*)
46 utf8_length parsed_text
48 (*let save_moo status =
49 let script = MatitaScript.current () in
50 let baseuri = status#baseuri in
51 match script#bos, script#eos with
54 GrafiteTypes.Serializer.serialize ~baseuri:(NUri.uri_of_string baseuri)
56 | _ -> clean_current_baseuri status
59 let sequent_size = ref 40;;
61 let include_paths = ref [];;
65 * <metaname>...</metaname>
72 let _,_,metasenv,subst,_ = s#obj in
73 let render_switch = function
74 | Stack.Open i -> "?" ^ (string_of_int i)
75 | Stack.Closed i -> "<S>?" ^ (string_of_int i) ^ "</S>"
77 let int_of_switch = function
78 | Stack.Open i | Stack.Closed i -> i
80 let sequent = function
82 let meta = List.assoc i metasenv in
83 snd (ApplyTransformation.ntxt_of_cic_sequent
84 ~metasenv ~subst ~map_unicode_to_tex:false !sequent_size s (i,meta))
85 | Stack.Closed _ -> "This goal has already been closed."
87 let render_sequent is_loc acc depth tag (pos,sw) =
88 let metano = int_of_switch sw in
91 (match depth, pos with
92 | 0, 0 -> "<B>" ^ (render_switch sw) ^ "</B>"
94 Printf.sprintf "<B>|<SUB>%d</SUB>: %s</B>" pos (render_switch sw)
95 | 1, pos when Stack.head_tag s#stack = `BranchTag ->
96 Printf.sprintf "|<SUB>%d</SUB> : %s" pos (render_switch sw)
97 | _ -> render_switch sw)
101 Netencoding.Html.encode ~in_enc:`Enc_utf8 ~prefer_name:false () markup in
102 let markup = "<metaname>" ^ markup ^ "</metaname>" in
104 Netencoding.Html.encode ~in_enc:`Enc_utf8 ~prefer_name:false () (sequent sw)
106 let txt0 = "<goal>" ^ sequent ^ "</goal>" in
107 "<meta number=\"" ^ (string_of_int metano) ^ "\">" ^ markup ^
108 txt0 ^ "</meta>" ^ acc
112 ~env:(render_sequent true) ~cont:(render_sequent false)
113 ~todo:(render_sequent false) "" s#stack) ^
115 (* prerr_endline ("sending metasenv:\n" ^ res); res *)
118 (* let html_of_status s =
119 let _,_,metasenv,subst,_ = s#obj in
120 let txt = List.fold_left
121 (fun acc (nmeta,_ as meta) ->
122 let txt0 = snd (ApplyTransformation.ntxt_of_cic_sequent
123 ~metasenv ~subst ~map_unicode_to_tex:false 80 s meta)
125 prerr_endline ("### txt0 = " ^ txt0);
126 ("<B>Goal ?" ^ (string_of_int nmeta) ^ "</B>\n" ^ txt0)::acc)
129 String.concat "\n\n" txt
132 let html_of_matita s =
133 let patt1 = Str.regexp "\005" in
134 let patt2 = Str.regexp "\006" in
135 let patt3 = Str.regexp "<" in
136 let patt4 = Str.regexp ">" in
137 let res = Str.global_replace patt4 ">" s in
138 let res = Str.global_replace patt3 "<" res in
139 let res = Str.global_replace patt2 ">" res in
140 let res = Str.global_replace patt1 "<" res in
144 let heading_nl_RE = Pcre.regexp "^\\s*\n\\s*";;
147 let s = Pcre.replace ~rex:heading_nl_RE s in
149 let nl_pos = String.index s '\n' in
150 String.sub s 0 nl_pos
154 let read_file fname =
155 let chan = open_in fname in
156 let lines = ref [] in
159 lines := input_line chan :: !lines
161 with End_of_file -> close_in chan);
162 String.concat "\n" (List.rev !lines)
165 let load_index outchan =
166 let s = read_file "index.html" in
167 Http_daemon.respond ~headers:["Content-Type", "text/html"] ~code:(`Code 200) ~body:s outchan
170 let load_doc filename outchan =
171 let s = read_file filename in
173 try String.sub filename (String.length filename - 4) 4 = ".png"
174 with Invalid_argument _ -> false
176 let contenttype = if is_png then "image/png" else "text/html" in
177 Http_daemon.respond ~headers:["Content-Type", contenttype] ~code:(`Code 200) ~body:s outchan
180 let retrieve (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
181 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
182 let env = cgi#environment in
184 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
185 let sid = HExtlib.unopt sid in
186 let uid = MatitaAuthentication.user_of_session sid in
190 ~content_type:"text/xml; charset=\"utf-8\""
193 let filename = libdir uid ^ "/" ^ (cgi # argument_value "file") in
194 (* prerr_endline ("reading file " ^ filename); *)
196 Netencoding.Html.encode ~in_enc:`Enc_utf8 ~prefer_name:false ()
197 (html_of_matita (read_file filename)) in
199 (* html_of_matita (read_file filename) in *)
200 (* prerr_endline ("sending:\nBEGIN\n" ^ body ^ "\nEND"); *)
201 let body = "<response><file>" ^ body ^ "</file></response>" in
202 let baseuri, incpaths =
204 let root, baseuri, _fname, _tgt =
205 Librarian.baseuri_of_script ~include_paths:[] filename in
208 Str.split (Str.regexp " ")
209 (List.assoc "include_paths" (Librarian.load_root_file (root^"/root")))
212 let rc = root :: includes in
213 List.iter (HLog.debug) rc; baseuri, rc
215 Librarian.NoRootFor _ | Librarian.FileNotFound _ -> "",[] in
216 include_paths := incpaths;
217 let status = (MatitaAuthentication.get_status sid)#set_baseuri baseuri in
218 let history = [status] in
219 MatitaAuthentication.set_status sid status;
220 MatitaAuthentication.set_history sid history;
223 ~content_type:"text/xml; charset=\"utf-8\""
225 cgi#out_channel#output_string body;
229 ~status:`Internal_server_error
231 ~content_type:"text/html; charset=\"utf-8\""
233 cgi#out_channel#commit_work()
236 let advance0 sid text =
237 let status = MatitaAuthentication.get_status sid in
238 let status = status#reset_disambiguate_db () in
239 let (st,new_statements,new_unparsed),(* newtext TODO *) _,parsed_len =
241 eval_statement !include_paths (*buffer*) status (`Raw text)
243 | HExtlib.Localized (_,e) -> raise e
244 (*| End_of_file -> raise Margin *)
246 let stringbuf = Ulexing.from_utf8_string new_statements in
247 let interpr = GrafiteDisambiguate.get_interpr st#disambiguate_db in
248 let outstr = ref "" in
249 ignore (SmallLexer.mk_small_printer interpr outstr stringbuf);
250 (* prerr_endline ("parser output: " ^ !outstr); *)
251 MatitaAuthentication.set_status sid st;
253 Netencoding.Html.encode ~in_enc:`Enc_utf8 ~prefer_name:false
254 () (html_of_matita !outstr), new_unparsed, st
256 let register (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
257 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
258 let env = cgi#environment in
260 assert (cgi#arguments <> []);
261 let uid = cgi#argument_value "userid" in
262 let userpw = cgi#argument_value "password" in
264 MatitaAuthentication.add_user uid userpw;
265 (* env#set_output_header_field "Location" "/index.html" *)
266 cgi#out_channel#output_string
267 ("<html><head><meta http-equiv=\"refresh\" content=\"2;url=/login.html\">"
268 ^ "</head><body>Redirecting to login page...</body></html>")
270 | MatitaAuthentication.UsernameCollision _ ->
273 ~content_type:"text/html; charset=\"utf-8\""
275 cgi#out_channel#output_string
276 "<html><head></head><body>Error: User id collision!</body></html>"
277 | MatitaFilesystem.SvnError msg ->
280 ~content_type:"text/html; charset=\"utf-8\""
282 cgi#out_channel#output_string
283 ("<html><head></head><body><p>Error: Svn checkout failed!<p><p><textarea>"
284 ^ msg ^ "</textarea></p></body></html>"));
285 cgi#out_channel#commit_work()
288 let login (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
289 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
290 let env = cgi#environment in
292 assert (cgi#arguments <> []);
293 let uid = cgi#argument_value "userid" in
294 let userpw = cgi#argument_value "password" in
295 let pw,_ = MatitaAuthentication.lookup_user uid in
299 let _ = MatitaFilesystem.html_of_library uid in
300 let sid = MatitaAuthentication.create_session uid in
301 (* let cookie = Netcgi.Cookie.make "session" (Uuidm.to_string sid) in
302 cgi#set_header ~set_cookies:[cookie] (); *)
303 env#set_output_header_field
304 "Set-Cookie" ("session=" ^ (Uuidm.to_string sid));
305 (* env#set_output_header_field "Location" "/index.html" *)
306 cgi#out_channel#output_string
307 ("<html><head><meta http-equiv=\"refresh\" content=\"2;url=/index.html\">"
308 ^ "</head><body>Redirecting to Matita page...</body></html>")
314 ~content_type:"text/html; charset=\"utf-8\""
316 cgi#out_channel#output_string
317 "<html><head></head><body>Authentication error</body></html>"
320 cgi#out_channel#commit_work()
324 let logout (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
325 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
326 let env = cgi#environment in
328 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
329 let sid = HExtlib.unopt sid in
330 MatitaAuthentication.logout_user sid;
333 ~content_type:"text/html; charset=\"utf-8\""
335 let text = read_file (rt_path () ^ "/logout.html") in
336 cgi#out_channel#output_string text
340 ~status:`Internal_server_error
342 ~content_type:"text/html; charset=\"utf-8\""
344 cgi#out_channel#commit_work()
347 exception File_already_exists;;
349 let save (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
350 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
351 let env = cgi#environment in
353 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
354 let sid = HExtlib.unopt sid in
355 let status = MatitaAuthentication.get_status sid in
356 let uid = MatitaAuthentication.user_of_session sid in
357 assert (cgi#arguments <> []);
358 let locked = cgi#argument_value "locked" in
359 let unlocked = cgi#argument_value "unlocked" in
360 let filename = libdir uid ^ "/" ^ (cgi # argument_value "file") in
361 let force = bool_of_string (cgi#argument_value "force") in
363 if ((not force) && (Sys.file_exists filename)) then
364 raise File_already_exists;
366 let oc = open_out filename in
367 output_string oc (locked ^ unlocked);
369 if MatitaEngine.eos status unlocked then
371 (* prerr_endline ("serializing proof objects..."); *)
372 GrafiteTypes.Serializer.serialize
373 ~baseuri:(NUri.uri_of_string status#baseuri) status;
374 (* prerr_endline ("adding to the commit queue..."); *)
375 MatitaFilesystem.add_user uid;
376 (* prerr_endline ("done."); *)
380 ~content_type:"text/xml; charset=\"utf-8\""
382 cgi#out_channel#output_string "<response>ok</response>"
384 | File_already_exists ->
385 cgi#out_channel#output_string "<response>cancelled</response>"
388 ~status:`Internal_server_error
390 ~content_type:"text/xml; charset=\"utf-8\""
392 cgi#out_channel#commit_work()
395 let initiate_commit (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
396 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
397 let env = cgi#environment in
399 let errors = MatitaFilesystem.do_global_commit () in
400 prerr_endline ("commit errors: " ^ (String.concat " " errors));
403 ~content_type:"text/xml; charset=\"utf-8\""
405 cgi#out_channel#output_string "<response>ok</response>"
409 ~status:`Internal_server_error
411 ~content_type:"text/xml; charset=\"utf-8\""
413 cgi#out_channel#commit_work()
416 (* returns the length of the executed text and an html representation of the
418 let advance (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
419 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
420 let env = cgi#environment in
422 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
423 let sid = HExtlib.unopt sid in
427 ~content_type:"text/xml; charset=\"utf-8\""
430 let text = cgi#argument_value "body" in
431 (* prerr_endline ("body =\n" ^ text); *)
432 let history = MatitaAuthentication.get_history sid in
433 let parsed_len, new_parsed, new_unparsed, new_status = advance0 sid text in
434 MatitaAuthentication.set_history sid (new_status::history);
435 let txt = output_status new_status in
437 "<response><parsed length=\"" ^ (string_of_int parsed_len) ^ "\">" ^
438 new_parsed ^ "</parsed>" ^ txt
441 (* prerr_endline ("sending advance response:\n" ^ body); *)
444 ~content_type:"text/xml; charset=\"utf-8\""
446 cgi#out_channel#output_string body
450 ~status:`Internal_server_error
452 ~content_type:"text/xml; charset=\"utf-8\""
454 cgi#out_channel#commit_work()
457 let gotoBottom (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
458 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
459 let env = cgi#environment in
461 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
462 let sid = HExtlib.unopt sid in
463 let history = MatitaAuthentication.get_history sid in
465 let rec aux parsed_len parsed_txt text =
467 prerr_endline ("evaluating: " ^ first_line text);
468 let plen,new_parsed,new_unparsed,_new_status = advance0 sid text in
469 aux (parsed_len+plen) (parsed_txt ^ new_parsed) new_unparsed
472 let status = MatitaAuthentication.get_status sid in
473 GrafiteTypes.Serializer.serialize
474 ~baseuri:(NUri.uri_of_string status#baseuri) status;
475 if parsed_len > 0 then
476 MatitaAuthentication.set_history sid (status::history);
477 parsed_len, parsed_txt
478 | _ -> parsed_len, parsed_txt
483 ~content_type:"text/xml; charset=\"utf-8\""
486 let text = cgi#argument_value "body" in
487 (* prerr_endline ("body =\n" ^ text); *)
488 let parsed_len, new_parsed = aux 0 "" text in
489 let status = MatitaAuthentication.get_status sid in
490 let txt = output_status status in
492 "<response><parsed length=\"" ^ (string_of_int parsed_len) ^ "\">" ^
493 new_parsed ^ "</parsed>" ^ txt
497 "<response><parsed length=\"" ^ (string_of_int parsed_len) ^ "\" />" ^ txt
500 (* prerr_endline ("sending goto bottom response:\n" ^ body); *)
503 ~content_type:"text/xml; charset=\"utf-8\""
505 cgi#out_channel#output_string body
506 with Not_found -> cgi#set_header ~status:`Internal_server_error
508 ~content_type:"text/xml; charset=\"utf-8\"" ());
509 cgi#out_channel#commit_work()
512 let gotoTop (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
513 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
514 let env = cgi#environment in
515 prerr_endline "executing goto Top";
517 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
518 let sid = HExtlib.unopt sid in
522 ~content_type:"text/xml; charset=\"utf-8\""
525 let status = MatitaAuthentication.get_status sid in
526 let uid = MatitaAuthentication.user_of_session sid in
527 let baseuri = status#baseuri in
528 let new_status = new MatitaEngine.status (Some uid) baseuri in
529 NCicLibrary.time_travel new_status;
530 let new_history = [new_status] in
531 MatitaAuthentication.set_history sid new_history;
532 MatitaAuthentication.set_status sid new_status;
533 NCicLibrary.time_travel new_status;
536 ~content_type:"text/xml; charset=\"utf-8\""
538 cgi#out_channel#output_string "<response>ok</response>"
540 (cgi#set_header ~status:`Internal_server_error
542 ~content_type:"text/xml; charset=\"utf-8\"" ();
543 cgi#out_channel#output_string "<response>ok</response>");
544 cgi#out_channel#commit_work())
547 let retract (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
548 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
549 let env = cgi#environment in
551 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
552 let sid = HExtlib.unopt sid in
556 ~content_type:"text/xml; charset=\"utf-8\""
559 let history = MatitaAuthentication.get_history sid in
560 let new_history,new_status =
562 _::(status::_ as history) ->
564 | [_] -> (prerr_endline "singleton";failwith "retract")
565 | _ -> (prerr_endline "nil"; assert false) in
566 NCicLibrary.time_travel new_status;
567 MatitaAuthentication.set_history sid new_history;
568 MatitaAuthentication.set_status sid new_status;
569 let body = output_status new_status in
572 ~content_type:"text/xml; charset=\"utf-8\""
574 cgi#out_channel#output_string body
575 with _ -> cgi#set_header ~status:`Internal_server_error
577 ~content_type:"text/xml; charset=\"utf-8\"" ());
578 cgi#out_channel#commit_work()
582 let viewLib (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
583 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
584 let env = cgi#environment in
586 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
587 let sid = HExtlib.unopt sid in
591 ~content_type:"text/html; charset=\"utf-8\""
594 let uid = MatitaAuthentication.user_of_session sid in
596 let html = MatitaFilesystem.html_of_library uid in
599 ~content_type:"text/html; charset=\"utf-8\""
601 cgi#out_channel#output_string
604 "<title>XML Tree Control</title>\n" ^
605 "<link href=\"treeview/xmlTree.css\" type=\"text/css\" rel=\"stylesheet\">\n" ^
606 "<script src=\"treeview/xmlTree.js\" type=\"text/javascript\"></script>\n" ^
608 html (* ^ "\n</body></html>" *) );
609 cgi#out_channel#commit_work()
613 let resetLib (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
614 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
615 MatitaAuthentication.reset ();
618 ~content_type:"text/html; charset=\"utf-8\""
621 cgi#out_channel#output_string
623 "<title>Matitaweb Reset</title>\n" ^
624 "<body><H1>Reset completed</H1></body></html>");
625 cgi#out_channel#commit_work()
627 open Netcgi1_compat.Netcgi_types;;
629 (**********************************************************************)
630 (* Create the webserver *)
631 (**********************************************************************)
635 let (opt_list, cmdline_cfg) = Netplex_main.args() in
637 let use_mt = ref true in
640 [ "-mt", Arg.Set use_mt,
641 " Use multi-threading instead of multi-processing"
646 (fun s -> raise (Arg.Bad ("Don't know what to do with: " ^ s)))
647 "usage: netplex [options]";
650 Netplex_mt.mt() (* multi-threading *)
652 Netplex_mp.mp() in (* multi-processing *)
655 { Nethttpd_services.dyn_handler = (fun _ -> process1);
656 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
657 dyn_uri = None; (* not needed *)
658 dyn_translator = (fun _ -> ""); (* not needed *)
659 dyn_accept_all_conditionals = false;
663 { Nethttpd_services.dyn_handler = (fun _ -> advance);
664 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
665 dyn_uri = None; (* not needed *)
666 dyn_translator = (fun _ -> ""); (* not needed *)
667 dyn_accept_all_conditionals = false;
670 { Nethttpd_services.dyn_handler = (fun _ -> retract);
671 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
672 dyn_uri = None; (* not needed *)
673 dyn_translator = (fun _ -> ""); (* not needed *)
674 dyn_accept_all_conditionals = false;
677 { Nethttpd_services.dyn_handler = (fun _ -> gotoBottom);
678 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
679 dyn_uri = None; (* not needed *)
680 dyn_translator = (fun _ -> ""); (* not needed *)
681 dyn_accept_all_conditionals = false;
684 { Nethttpd_services.dyn_handler = (fun _ -> gotoTop);
685 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
686 dyn_uri = None; (* not needed *)
687 dyn_translator = (fun _ -> ""); (* not needed *)
688 dyn_accept_all_conditionals = false;
691 { Nethttpd_services.dyn_handler = (fun _ -> retrieve);
692 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
693 dyn_uri = None; (* not needed *)
694 dyn_translator = (fun _ -> ""); (* not needed *)
695 dyn_accept_all_conditionals = false;
698 { Nethttpd_services.dyn_handler = (fun _ -> register);
699 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
700 dyn_uri = None; (* not needed *)
701 dyn_translator = (fun _ -> ""); (* not needed *)
702 dyn_accept_all_conditionals = false;
705 { Nethttpd_services.dyn_handler = (fun _ -> login);
706 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
707 dyn_uri = None; (* not needed *)
708 dyn_translator = (fun _ -> ""); (* not needed *)
709 dyn_accept_all_conditionals = false;
712 { Nethttpd_services.dyn_handler = (fun _ -> logout);
713 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
714 dyn_uri = None; (* not needed *)
715 dyn_translator = (fun _ -> ""); (* not needed *)
716 dyn_accept_all_conditionals = false;
719 { Nethttpd_services.dyn_handler = (fun _ -> viewLib);
720 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
721 dyn_uri = None; (* not needed *)
722 dyn_translator = (fun _ -> ""); (* not needed *)
723 dyn_accept_all_conditionals = false;
726 { Nethttpd_services.dyn_handler = (fun _ -> resetLib);
727 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
728 dyn_uri = None; (* not needed *)
729 dyn_translator = (fun _ -> ""); (* not needed *)
730 dyn_accept_all_conditionals = false;
733 { Nethttpd_services.dyn_handler = (fun _ -> save);
734 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
735 dyn_uri = None; (* not needed *)
736 dyn_translator = (fun _ -> ""); (* not needed *)
737 dyn_accept_all_conditionals = false;
740 { Nethttpd_services.dyn_handler = (fun _ -> initiate_commit);
741 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
742 dyn_uri = None; (* not needed *)
743 dyn_translator = (fun _ -> ""); (* not needed *)
744 dyn_accept_all_conditionals = false;
747 let nethttpd_factory =
748 Nethttpd_plex.nethttpd_factory
749 ~handlers:[ "advance", do_advance
750 ; "retract", do_retract
751 ; "bottom", goto_bottom
754 ; "register", do_register
756 ; "logout", do_logout
757 ; "reset", do_resetlib
758 ; "viewlib", do_viewlib
760 ; "commit", do_commit]
762 MatitaInit.initialize_all ();
763 MatitaAuthentication.deserialize ();
766 Netplex_log.logger_factories (* allow all built-in logging styles *)
767 Netplex_workload.workload_manager_factories (* ... all ways of workload management *)
768 [ nethttpd_factory ] (* make this nethttpd available *)
772 Sys.set_signal Sys.sigpipe Sys.Signal_ignore;