···1011 {2 Supported Headers}
1213- - {!Content-Range} - Partial content range specification (RFC 9110 Section 14.4)
14- - {!If-Range} - Conditional range request (RFC 9110 Section 13.1.5)
15- - {!Allow} - Supported HTTP methods (RFC 9110 Section 10.2.1)
16- - {!Authentication-Info} - Post-authentication info (RFC 9110 Section 11.6.3)
17- - {!Retry-After} - Retry delay specification (RFC 9110 Section 10.2.3)
18- - {!Accept-Ranges} - Range support indication (RFC 9110 Section 14.3)
19- - {!Cache-Status} - Cache handling indication (RFC 9211)
20- - {!Content-Digest} / {!Repr-Digest} - Body integrity verification (RFC 9530)
21- - {!Strict-Transport-Security} - HSTS policy (RFC 6797)
2223 @see <https://www.rfc-editor.org/rfc/rfc9110> RFC 9110: HTTP Semantics
24 @see <https://www.rfc-editor.org/rfc/rfc9211> RFC 9211: Cache-Status
25 @see <https://www.rfc-editor.org/rfc/rfc9530> RFC 9530: Digest Fields
26 @see <https://www.rfc-editor.org/rfc/rfc6797> RFC 6797: HTTP Strict Transport Security *)
2728-(** {1 Content-Range (RFC 9110 Section 14.4)}
2930 The Content-Range header indicates which part of a representation is
31 enclosed when a 206 (Partial Content) response is returned.
···52 Returns [None] if the value cannot be parsed.
5354 Examples:
55- - ["bytes 0-499/1234"] -> Some {unit="bytes"; range=Some(0,499); complete_length=Some 1234}
56- - ["bytes */1234"] -> Some {unit="bytes"; range=None; complete_length=Some 1234} *)
5758val make_content_range : start:int64 -> end_:int64 -> complete_length:int64 -> content_range
59(** [make_content_range ~start ~end_ ~complete_length] creates a Content-Range
···67(** [make_unsatisfied_range ~complete_length] creates a Content-Range value for
68 an unsatisfied range (416 response). *)
6970-(** {1 If-Range (RFC 9110 Section 13.1.5)}
7172 The If-Range header makes a Range request conditional. It can contain
73 either an ETag or a Last-Modified date.
···101val if_range_is_date : if_range -> bool
102(** [if_range_is_date ir] returns [true] if [ir] is a date. *)
103104-(** {1 Allow (RFC 9110 Section 10.2.1)}
105106 The Allow header lists the set of methods supported by the target resource.
107···120val allow_contains : Method.t -> string -> bool
121(** [allow_contains method_ allow_value] checks if a method is in an Allow header value. *)
122123-(** {1 Authentication-Info (RFC 9110 Section 11.6.3)}
124125 The Authentication-Info header is sent by the server after successful
126 authentication. For Digest authentication, it provides:
···158val get_nextnonce : authentication_info -> string option
159(** [get_nextnonce info] returns the next nonce, if present. *)
160161-(** {1 Retry-After (RFC 9110 Section 10.2.3)}
162163 The Retry-After header indicates how long to wait before retrying.
164···185186 @param now The current time as a Unix timestamp (for date calculation) *)
187188-(** {1 Accept-Ranges (RFC 9110 Section 14.3)}
189190 The Accept-Ranges header indicates whether the server supports range requests.
191···209val supports_byte_ranges : accept_ranges -> bool
210(** [supports_byte_ranges ar] returns [true] if byte range requests are supported. *)
211212-(** {1 Cache-Status (RFC 9211)}
213214 The Cache-Status header field indicates how caches have handled a request.
215 It is a List structured field (RFC 8941) where each member is a cache
···291(** [cache_status_get_fwd entries] returns the forward reason from the first
292 cache that forwarded the request, if any. *)
293294-(** {1 Content-Digest / Repr-Digest (RFC 9530)}
295296 Content-Digest contains a digest of the content (after content coding).
297 Repr-Digest contains a digest of the representation (before content coding).
···358(** [get_strongest_digest digests] returns the strongest available digest.
359 Prefers SHA-512 over SHA-256 over others. *)
360361-(** {1 Strict-Transport-Security (RFC 6797)}
362363 The Strict-Transport-Security (HSTS) header tells browsers to only
364 access the site over HTTPS, protecting against protocol downgrade
···384 Returns [None] if the required max-age directive is missing.
385386 Example: ["max-age=31536000; includeSubDomains"] ->
387- Some {max_age=31536000; include_subdomains=true; preload=false} *)
388389val hsts_to_string : hsts -> string
390(** [hsts_to_string hsts] formats an HSTS value as a header string.
391392- Example: {max_age=31536000; include_subdomains=true; preload=false} ->
393 ["max-age=31536000; includeSubDomains"] *)
394395val make_hsts : ?max_age:int64 -> ?include_subdomains:bool -> ?preload:bool -> unit -> hsts
···1011 {2 Supported Headers}
1213+ - {{!section-content_range}Content-Range} - Partial content range specification (RFC 9110 Section 14.4)
14+ - {{!section-if_range}If-Range} - Conditional range request (RFC 9110 Section 13.1.5)
15+ - {{!section-allow}Allow} - Supported HTTP methods (RFC 9110 Section 10.2.1)
16+ - {{!section-authentication_info}Authentication-Info} - Post-authentication info (RFC 9110 Section 11.6.3)
17+ - {{!section-retry_after}Retry-After} - Retry delay specification (RFC 9110 Section 10.2.3)
18+ - {{!section-accept_ranges}Accept-Ranges} - Range support indication (RFC 9110 Section 14.3)
19+ - {{!section-cache_status}Cache-Status} - Cache handling indication (RFC 9211)
20+ - {{!section-content_digest}Content-Digest / Repr-Digest} - Body integrity verification (RFC 9530)
21+ - {{!section-hsts}Strict-Transport-Security} - HSTS policy (RFC 6797)
2223 @see <https://www.rfc-editor.org/rfc/rfc9110> RFC 9110: HTTP Semantics
24 @see <https://www.rfc-editor.org/rfc/rfc9211> RFC 9211: Cache-Status
25 @see <https://www.rfc-editor.org/rfc/rfc9530> RFC 9530: Digest Fields
26 @see <https://www.rfc-editor.org/rfc/rfc6797> RFC 6797: HTTP Strict Transport Security *)
2728+(** {1:content_range Content-Range (RFC 9110 Section 14.4)}
2930 The Content-Range header indicates which part of a representation is
31 enclosed when a 206 (Partial Content) response is returned.
···52 Returns [None] if the value cannot be parsed.
5354 Examples:
55+ - ["bytes 0-499/1234"] -> [Some \{unit="bytes"; range=Some(0,499); complete_length=Some 1234\}]
56+ - ["bytes */1234"] -> [Some \{unit="bytes"; range=None; complete_length=Some 1234\}] *)
5758val make_content_range : start:int64 -> end_:int64 -> complete_length:int64 -> content_range
59(** [make_content_range ~start ~end_ ~complete_length] creates a Content-Range
···67(** [make_unsatisfied_range ~complete_length] creates a Content-Range value for
68 an unsatisfied range (416 response). *)
6970+(** {1:if_range If-Range (RFC 9110 Section 13.1.5)}
7172 The If-Range header makes a Range request conditional. It can contain
73 either an ETag or a Last-Modified date.
···101val if_range_is_date : if_range -> bool
102(** [if_range_is_date ir] returns [true] if [ir] is a date. *)
103104+(** {1:allow Allow (RFC 9110 Section 10.2.1)}
105106 The Allow header lists the set of methods supported by the target resource.
107···120val allow_contains : Method.t -> string -> bool
121(** [allow_contains method_ allow_value] checks if a method is in an Allow header value. *)
122123+(** {1:authentication_info Authentication-Info (RFC 9110 Section 11.6.3)}
124125 The Authentication-Info header is sent by the server after successful
126 authentication. For Digest authentication, it provides:
···158val get_nextnonce : authentication_info -> string option
159(** [get_nextnonce info] returns the next nonce, if present. *)
160161+(** {1:retry_after Retry-After (RFC 9110 Section 10.2.3)}
162163 The Retry-After header indicates how long to wait before retrying.
164···185186 @param now The current time as a Unix timestamp (for date calculation) *)
187188+(** {1:accept_ranges Accept-Ranges (RFC 9110 Section 14.3)}
189190 The Accept-Ranges header indicates whether the server supports range requests.
191···209val supports_byte_ranges : accept_ranges -> bool
210(** [supports_byte_ranges ar] returns [true] if byte range requests are supported. *)
211212+(** {1:cache_status Cache-Status (RFC 9211)}
213214 The Cache-Status header field indicates how caches have handled a request.
215 It is a List structured field (RFC 8941) where each member is a cache
···291(** [cache_status_get_fwd entries] returns the forward reason from the first
292 cache that forwarded the request, if any. *)
293294+(** {1:content_digest Content-Digest / Repr-Digest (RFC 9530)}
295296 Content-Digest contains a digest of the content (after content coding).
297 Repr-Digest contains a digest of the representation (before content coding).
···358(** [get_strongest_digest digests] returns the strongest available digest.
359 Prefers SHA-512 over SHA-256 over others. *)
360361+(** {1:hsts Strict-Transport-Security (RFC 6797)}
362363 The Strict-Transport-Security (HSTS) header tells browsers to only
364 access the site over HTTPS, protecting against protocol downgrade
···384 Returns [None] if the required max-age directive is missing.
385386 Example: ["max-age=31536000; includeSubDomains"] ->
387+ [Some \{max_age=31536000; include_subdomains=true; preload=false\}] *)
388389val hsts_to_string : hsts -> string
390(** [hsts_to_string hsts] formats an HSTS value as a header string.
391392+ Example: [\{max_age=31536000; include_subdomains=true; preload=false\}] ->
393 ["max-age=31536000; includeSubDomains"] *)
394395val make_hsts : ?max_age:int64 -> ?include_subdomains:bool -> ?preload:bool -> unit -> hsts
+1-1
lib/headers.mli
···284285(** {1 Connection Header Handling}
286287- Per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-7.6.1}RFC 9110 Section 7.6.1}}:
288 The Connection header field lists hop-by-hop header fields that MUST be
289 removed before forwarding the message. *)
290
···284285(** {1 Connection Header Handling}
286287+ Per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-7.6.1}RFC 9110 Section 7.6.1}:
288 The Connection header field lists hop-by-hop header fields that MUST be
289 removed before forwarding the message. *)
290