2 let callback (req: Http_types.request) outchan =
3 match req#authorization with
4 | Some (`Basic (username, password))
5 when username = "foo" && password = "bar" ->
6 Http_daemon.respond ~code:200 ~body:"secret page!" outchan
7 | _ -> raise (Http_types.Unauthorized "my secret site")
9 let _ = Http_daemon.start' ~port:9999 callback