···1314 {2 Security}
1516- Per {{:https://datatracker.ietf.org/doc/html/rfc7617#section-4}RFC 7617 Section 4}} and
17- {{:https://datatracker.ietf.org/doc/html/rfc6750#section-5.1}RFC 6750 Section 5.1}},
18 Basic, Bearer, and Digest authentication transmit credentials that MUST be
19 protected by TLS. The library enforces HTTPS by default for these schemes. *)
20
···1314 {2 Security}
1516+ Per {{:https://datatracker.ietf.org/doc/html/rfc7617#section-4}RFC 7617 Section 4} and
17+ {{:https://datatracker.ietf.org/doc/html/rfc6750#section-5.1}RFC 6750 Section 5.1},
18 Basic, Bearer, and Digest authentication transmit credentials that MUST be
19 protected by TLS. The library enforces HTTPS by default for these schemes. *)
20
+2-2
lib/headers.mli
···6(** HTTP header field handling per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-5}RFC 9110 Section 5}
78 This module provides an efficient implementation of HTTP headers with
9- case-insensitive field names per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-5.1}RFC 9110 Section 5.1}}.
10 Headers can have multiple values for the same field name (e.g., Set-Cookie).
1112 {2 Security}
1314 Header names and values are validated to prevent HTTP header injection
15 attacks. CR and LF characters are rejected per
16- {{:https://datatracker.ietf.org/doc/html/rfc9110#section-5.5}RFC 9110 Section 5.5}}.
1718 {2 Examples}
19
···6(** HTTP header field handling per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-5}RFC 9110 Section 5}
78 This module provides an efficient implementation of HTTP headers with
9+ case-insensitive field names per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-5.1}RFC 9110 Section 5.1}.
10 Headers can have multiple values for the same field name (e.g., Set-Cookie).
1112 {2 Security}
1314 Header names and values are validated to prevent HTTP header injection
15 attacks. CR and LF characters are rejected per
16+ {{:https://datatracker.ietf.org/doc/html/rfc9110#section-5.5}RFC 9110 Section 5.5}.
1718 {2 Examples}
19
+1-1
lib/method.mli
···11 {2 Safe Methods}
1213 Methods are considered "safe" if their semantics are read-only (GET, HEAD,
14- OPTIONS, TRACE). Per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-9.2.1}RFC 9110 Section 9.2.1}}.
1516 {2 Idempotent Methods}
17
···11 {2 Safe Methods}
1213 Methods are considered "safe" if their semantics are read-only (GET, HEAD,
14+ OPTIONS, TRACE). Per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-9.2.1}RFC 9110 Section 9.2.1}.
1516 {2 Idempotent Methods}
17
+2-2
lib/one.mli
···10 Each request opens a new TCP connection (with TLS for https://) that is
11 closed when the Eio switch closes.
1213- Implements {{:https://datatracker.ietf.org/doc/html/rfc9112}RFC 9112}} (HTTP/1.1)
14- with {{:https://datatracker.ietf.org/doc/html/rfc9110}RFC 9110}} semantics.
1516 For stateful requests with automatic cookie handling, connection pooling,
17 and persistent configuration, use the main {!Requests} module instead.
···10 Each request opens a new TCP connection (with TLS for https://) that is
11 closed when the Eio switch closes.
1213+ Implements {{:https://datatracker.ietf.org/doc/html/rfc9112}RFC 9112} (HTTP/1.1)
14+ with {{:https://datatracker.ietf.org/doc/html/rfc9110}RFC 9110} semantics.
1516 For stateful requests with automatic cookie handling, connection pooling,
17 and persistent configuration, use the main {!Requests} module instead.
+4-4
lib/requests.mli
···107108 {b Exception-Based Errors:}
109110- All request functions may raise exceptions from the {!Error} module:
111 - {!exception:Error.Timeout}: Request exceeded timeout limit
112 - {!exception:Error.ConnectionError}: Network connection failed
113 - {!exception:Error.TooManyRedirects}: Exceeded maximum redirect count
···161 log_error "Unexpected error: %s" (Printexc.to_string exn)
162 ]}
163164- The {!Error} module also provides a Result-based API for functional error
165 handling, though the primary API uses exceptions for better integration
166 with Eio's structured concurrency.
167···284 HTTP requests use absolute-URI form (RFC 9112 Section 3.2.2).
285 HTTPS requests use CONNECT tunneling (RFC 9110 Section 9.3.6).
286 @param allow_insecure_auth Allow Basic/Bearer/Digest authentication over plaintext HTTP (default: false).
287- Per {{:https://datatracker.ietf.org/doc/html/rfc7617#section-4}RFC 7617 Section 4}} and
288- {{:https://datatracker.ietf.org/doc/html/rfc6750#section-5.1}RFC 6750 Section 5.1}},
289 these auth schemes transmit credentials that SHOULD be protected by TLS.
290 {b Only set to [true] for local development or testing environments.}
291 Example for local dev server:
···107108 {b Exception-Based Errors:}
109110+ All request functions may raise exceptions from the {!module:Error} module:
111 - {!exception:Error.Timeout}: Request exceeded timeout limit
112 - {!exception:Error.ConnectionError}: Network connection failed
113 - {!exception:Error.TooManyRedirects}: Exceeded maximum redirect count
···161 log_error "Unexpected error: %s" (Printexc.to_string exn)
162 ]}
163164+ The {!module:Error} module also provides a Result-based API for functional error
165 handling, though the primary API uses exceptions for better integration
166 with Eio's structured concurrency.
167···284 HTTP requests use absolute-URI form (RFC 9112 Section 3.2.2).
285 HTTPS requests use CONNECT tunneling (RFC 9110 Section 9.3.6).
286 @param allow_insecure_auth Allow Basic/Bearer/Digest authentication over plaintext HTTP (default: false).
287+ Per {{:https://datatracker.ietf.org/doc/html/rfc7617#section-4}RFC 7617 Section 4} and
288+ {{:https://datatracker.ietf.org/doc/html/rfc6750#section-5.1}RFC 6750 Section 5.1},
289 these auth schemes transmit credentials that SHOULD be protected by TLS.
290 {b Only set to [true] for local development or testing environments.}
291 Example for local dev server:
+1-1
lib/response.mli
···9 status codes, headers, and response bodies. Responses support streaming
10 to efficiently handle large payloads.
1112- Caching semantics follow {{:https://datatracker.ietf.org/doc/html/rfc9111}RFC 9111}} (HTTP Caching).
1314 {2 Examples}
15
···9 status codes, headers, and response bodies. Responses support streaming
10 to efficiently handle large payloads.
1112+ Caching semantics follow {{:https://datatracker.ietf.org/doc/html/rfc9111}RFC 9111} (HTTP Caching).
1314 {2 Examples}
15
+2-2
lib/retry.mli
···78 This module provides configurable retry logic for HTTP requests,
9 including exponential backoff, custom retry predicates, and
10- Retry-After header support per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-10.2.3}RFC 9110 Section 10.2.3}}.
1112 {2 Custom Retry Predicates}
13···106107(** Parse Retry-After header value (seconds or HTTP date).
108109- Per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-10.2.3}RFC 9110 Section 10.2.3}},
110 Retry-After can be either:
111 - A non-negative integer (delay in seconds)
112 - An HTTP-date (absolute time to retry after)
···78 This module provides configurable retry logic for HTTP requests,
9 including exponential backoff, custom retry predicates, and
10+ Retry-After header support per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-10.2.3}RFC 9110 Section 10.2.3}.
1112 {2 Custom Retry Predicates}
13···106107(** Parse Retry-After header value (seconds or HTTP date).
108109+ Per {{:https://datatracker.ietf.org/doc/html/rfc9110#section-10.2.3}RFC 9110 Section 10.2.3},
110 Retry-After can be either:
111 - A non-negative integer (delay in seconds)
112 - An HTTP-date (absolute time to retry after)