H2_adapterHTTP/2 Adapter for Requests Library.
This module provides integration between the H2 implementation and the Requests library, handling automatic response decompression.
NOTE: Connection state caching was removed because it was incompatible with how Conpool manages TCP connections. For proper HTTP/2 multiplexing with connection reuse, the connection management needs to be integrated at the Conpool level.
match H2_adapter.request ~flow ~uri ~headers ~method_:`GET
~auto_decompress:true () with
| Ok resp -> Printf.printf "Status: %d\n" resp.status
| Error msg -> Printf.printf "Error: %s\n" msgval body_to_string_opt : Body.t -> string optionbody_to_string_opt body converts a request body to a string option. Returns None for empty bodies or streaming bodies that can't be converted.
val make_response : auto_decompress:bool -> H2_protocol.response -> responsemake_response ~auto_decompress h2_resp converts an H2_protocol response to an adapter response, applying decompression if enabled.
val request :
sw:Eio.Switch.t ->
flow:[> Eio.Flow.two_way_ty ] Eio.Resource.t ->
uri:Uri.t ->
headers:Headers.t ->
?body:Body.t ->
method_:Method.t ->
auto_decompress:bool ->
unit ->
(response, string) resultrequest ~sw ~flow ~uri ~headers ?body ~method_ ~auto_decompress () makes an HTTP/2 request.
This function creates a fresh H2_client for each request and performs a new handshake. For proper HTTP/2 multiplexing with connection reuse, the connection management needs to be integrated at the Conpool level.
val one_request :
sw:Eio.Switch.t ->
flow:[> Eio.Flow.two_way_ty ] Eio.Resource.t ->
uri:Uri.t ->
headers:Headers.t ->
?body:Body.t ->
method_:Method.t ->
auto_decompress:bool ->
unit ->
(response, string) resultone_request is an alias for request.
clear_connection_cache () is a no-op (caching was removed).