(** HTTP-date parsing and formatting per RFC 7231 Section 7.1.1.1. *) (** {1 Types} *) (** Parse status. *) type status = | Valid (** Successfully parsed *) | Invalid (** Invalid date format *) (** {1 Parsing} *) (** Parse HTTP-date from span. Accepts all three formats (IMF-fixdate, RFC 850, asctime). Returns (status, timestamp) where timestamp is Unix seconds since epoch. Only valid if status = Valid. *) val parse : Base_bigstring.t -> Span.t -> status * float (** {1 Formatting} *) (** Format Unix timestamp as IMF-fixdate string (allocates). Example: ["Sun, 06 Nov 1994 08:49:37 GMT"] *) val format : float -> string (** {1 Response Writing} *) (** Write [Date: \r\n] header. Returns new offset. *) val write_date_header : Base_bigstring.t -> off:int -> float -> int (** Write [Last-Modified: \r\n] header. Returns new offset. *) val write_last_modified : Base_bigstring.t -> off:int -> float -> int (** Write [Expires: \r\n] header. Returns new offset. *) val write_expires : Base_bigstring.t -> off:int -> float -> int (** Write formatted HTTP-date at offset (no header name, no CRLF). Returns new offset. Used internally by header writers. *) val write_http_date : Base_bigstring.t -> off:int -> float -> int (** {2 Comparison Helpers} *) (** Check if resource was modified since the given date. *) val is_modified_since : last_modified:float -> if_modified_since:float -> bool (** Check if resource was not modified since the given date. *) val is_unmodified_since : last_modified:float -> if_unmodified_since:float -> bool