From 7b14cbd6a7bd3e45c8e551b7901daa4efdb3396d Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Thu, 16 Dec 2021 00:26:07 -0500 Subject: [PATCH] rename `time` into `start_time` --- src/Tiny_httpd.ml | 8 ++++---- src/Tiny_httpd.mli | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Tiny_httpd.ml b/src/Tiny_httpd.ml index 1c7711fe..3ec46dea 100644 --- a/src/Tiny_httpd.ml +++ b/src/Tiny_httpd.ml @@ -367,7 +367,7 @@ module Request = struct path_components: string list; query: (string*string) list; body: 'body; - time: float; + start_time: float; } let headers self = self.headers @@ -375,7 +375,7 @@ module Request = struct let meth self = self.meth let path self = self.path let body self = self.body - let time self = self.time + let start_time self = self.start_time let non_query_path self = Tiny_httpd_util.get_non_query_path self.path @@ -487,7 +487,7 @@ module Request = struct let parse_req_start ~buf (bs:byte_stream) : unit t option resp_result = try let line = Byte_stream.read_line ~buf bs in - let time = Unix.gettimeofday () in + let start_time = Unix.gettimeofday () in let meth, path = try let m, p, v = Scanf.sscanf line "%s %s HTTP/1.%d\r" (fun x y z->x,y,z) in @@ -513,7 +513,7 @@ module Request = struct | Error e -> bad_reqf 400 "invalid query: %s" e in Ok (Some {meth; query; host; path; path_components; - headers; body=(); time}) + headers; body=(); start_time; }) with | End_of_file | Sys_error _ -> Ok None | Bad_req (c,s) -> Error (c,s) diff --git a/src/Tiny_httpd.mli b/src/Tiny_httpd.mli index dad0a702..58c67314 100644 --- a/src/Tiny_httpd.mli +++ b/src/Tiny_httpd.mli @@ -281,8 +281,9 @@ module Request : sig val body : 'b t -> 'b (** Request body, possibly empty. *) - val time : 'b t -> float - (** time (from [Unix.gettimeofday] after parsing the first line*) + val start_time : _ t -> float + (** time stamp (from {!Unix.gettimeofday}) after parsing the first line of the request + @since NEXT_RELEASE *) val limit_body_size : max_size:int -> byte_stream t -> byte_stream t (** Limit the body size to [max_size] bytes, or return