* 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
(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 *)
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
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
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'
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