mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 03:05:29 -05:00
rename time into start_time
This commit is contained in:
parent
672e33c827
commit
7b14cbd6a7
2 changed files with 7 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue