diff options
-rw-r--r-- | src/ucs.ml | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -30,11 +30,10 @@ let fetch group = >>= fun (_resp, body) -> Cohttp_lwt.Body.to_string body -let log req = - let uri = Request.uri req and - datetime = CalendarLib.( +let log uri = + let datetime = CalendarLib.( Printer.Calendar.sprint "%Y-%m-%d %H:%M:%S" @@ Calendar.now ()) in - Lwt_io.printlf "[%s] %s" datetime (Uri.path uri) + Lwt_io.printlf "[%s] %s" datetime (Uri.path_and_query uri) let respond ?(mime="text/html; charset=utf-8") ?(status=`OK) body = let headers = Header.init_with "Content-Type" mime in @@ -48,7 +47,7 @@ let server = |> Astring.String.cuts ~empty:false ~sep:"/" |> List.map Uri.pct_decode and query = Uri.query uri in - log req >>= fun () -> + log uri >>= fun () -> match meth, path, query with | `GET, ([] | ["index.html"]), [] -> respond Pages.main | `GET, ["lnk"], ["group", [group]] -> |