]> matita.cs.unibo.it Git - helm.git/commitdiff
- added some TODO comments
authorStefano Zacchiroli <zack@upsilon.cc>
Sun, 5 Jan 2003 14:16:01 +0000 (14:16 +0000)
committerStefano Zacchiroli <zack@upsilon.cc>
Sun, 5 Jan 2003 14:16:01 +0000 (14:16 +0000)
- added support for callback raised Quit exception

helm/DEVEL/ocaml-http/debian/changelog
helm/DEVEL/ocaml-http/http_daemon.ml

index ff405be8615e8105368c06bc529a75cb811aa931..e8fddf21ec61a97c71c8b1ec56e738aabcef7837 100644 (file)
@@ -9,6 +9,9 @@ ocaml-http (0.0.7) unstable; urgency=low
   * Added OO daemon interfaces ("daemon" and "connection" classes)
   * Use Pcre to perform sanity test on headers instead of home made
     parsing
+  * Callback functions can raise Http_types.Quit to have main daemon
+    quit
+  * Case-insensitive handling of header names
 
  -- Stefano Zacchiroli <zack@debian.org>  Wed, 25 Dec 2002 16:22:31 +0100
 
index a56780a9fb1252e78921fc80c4c714ec1f16dd15..9e49551f4c6ac742ceaebd1a3040cc624814b9d7 100644 (file)
@@ -59,9 +59,9 @@ let get_code_argument func_name =
     (match code, status with
     | Some c, None -> c
     | None, Some s -> code_of_status s
-    | Some _, Some _ ->
+    | Some _, Some _ -> (* TODO use some static type checking *)
         failwith (func_name ^ " you must give 'code' or 'status', not both")
-    | None, None ->
+    | None, None -> (* TODO use some static type checking *)
         failwith (func_name ^ " you must give 'code' or 'status', not none"))
 
   (** internal: low level for send_status_line *)
@@ -200,7 +200,8 @@ let send_file ?name ?file outchan =
         let f = open_in n in
         f, (fun () -> close_in f)
     | None, Some f -> (f, (fun () -> ()))
-    | _ -> failwith "Daemon.send_file: either name or file must be given")
+    | _ ->  (* TODO use some static type checking *)
+        failwith "Daemon.send_file: either name or file must be given")
   in
   try
     while true do
@@ -275,6 +276,9 @@ let respond_with (res: Http_types.response) outchan =
   res#serialize outchan;
   flush outchan
 
+  (** internal: this exception is raised after a malformed request has been read
+  by a serving process to signal main server (or itself if mode = `Single) to
+  skip to next request *)
 exception Again;;
 
   (* given a Http_parser.parse_request like function, wrap it in a function that
@@ -364,7 +368,9 @@ let start
       flush outchan
     with Again -> ()
   in
-  (server_of_mode mode) ~sockaddr ~timeout daemon_callback 
+  try
+    (server_of_mode mode) ~sockaddr ~timeout daemon_callback 
+  with Quit -> ()
 
   (* OO request *)
 let start'
@@ -380,7 +386,9 @@ let start'
       flush outchan
     with Again -> ()
   in
-  (server_of_mode mode) ~sockaddr ~timeout daemon_callback 
+  try
+    (server_of_mode mode) ~sockaddr ~timeout daemon_callback 
+  with Quit -> ()
 
 module Trivial =
   struct